Refactor canvas workbench seams and image generation capabilities#38
Refactor canvas workbench seams and image generation capabilities#38
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d36e7d9d37
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| metadata: metadata as Record<string, unknown>, | ||
| includeThumbnail: Boolean(thumbnailBlob), | ||
| }); | ||
| const id = prepared.assetId; |
There was a problem hiding this comment.
Avoid creating local assets with reused remote IDs
When prepareAssetUpload returns existing: true, this code reuses prepared.assetId as the new local asset ID and still appends a new asset record. If two imported files share content (e.g., same bytes with different filenames) or the hash already exists remotely, multiple local entries can end up with the same id, while IndexedDB put overwrites by key. That leaves in-memory state with duplicate IDs and causes later update/delete logic to act on the wrong asset instance.
Useful? React with 👍 / 👎.
| const mimeType = request.headers["content-type"]; | ||
| if (typeof mimeType !== "string" || !mimeType.startsWith("image/")) { | ||
| return reply.code(400).send({ error: "Only image uploads are supported." }); |
There was a problem hiding this comment.
Register a parser for binary image upload bodies
This route expects image/* request bodies and then reads raw bytes, but the server setup never registers a content-type parser for image/*. In Fastify, unsupported content types are rejected before the handler runs, so PUT /api/assets/upload/:assetId/:kind will return 415 for normal image uploads and new asset uploads cannot complete.
Useful? React with 👍 / 👎.
Summary
Testing
pnpm exec eslint src/features/canvas/CanvasViewportStageShell.tsxpnpm exec vitest --run src/features/canvas/viewportOverlay.test.ts src/features/canvas/textRuntimeViewModel.test.ts src/features/canvas/elements/TextElement.test.ts