fix(media): wire cloudflareUploadComplete across all upload surfaces [NES-1689]#9239
Conversation
…loads complete [NES-1689] Adds uploaded:true to the getMyCloudflareImages where clause and wires the cloudflareUploadComplete mutation in ImageUpload so successful direct-file uploads flip the row to uploaded:true. Together these prevent orphan rows from abandoned/failed Cloudflare POSTs from surfacing as broken image tiles in the picker grid. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit fa5ef40
☁️ Nx Cloud last updated this comment at |
|
The latest updates on your projects.
|
… surfaces [NES-1689] Addresses ce-review findings: P0 - wire cloudflareUploadComplete into useImageUpload and SocialScreenSocialImage so images uploaded through those surfaces flip uploaded=true; without this, the new BE filter would permanently hide them. P1 - split try/catch in ImageUpload so a cloudflareUploadComplete failure reports upload-mark-complete-failed instead of mislabeling as upload-exception (which leaked the Cloudflare asset). P2 - extract useCloudflareUploadCompleteMutation to libs/ following the useCloudflareUploadByFileMutation pattern; defer setSuccess(true) until after the mutation resolves; add a spec for the mutation-failure path; drop a redundant uploaded:true filter assertion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Splits BE filter into a separate follow-up ticket. This PR now ships the FE wiring only: every direct-file upload flips uploaded=true going forward, but the picker continues returning all rows (including historical orphans) until the filter ships later. Sequencing avoids the gallery-wipe regression that would happen if the filter shipped before the FE wiring had time to mark existing in-flight uploads complete. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Wires the
cloudflareUploadCompletemutation into every journeys-admin file-upload surface so direct-file uploads flipCloudflareImage.uploadedtotrue. The companion BE filter ongetMyCloudflareImagesis split out to a follow-up ticket so historical orphan rows aren't silently hidden the moment the filter ships.useCloudflareUploadCompleteMutationlib hook (apps/journeys-admin/src/libs/) following the existinguseCloudflareUploadByFileMutationpattern (hook + index + mock helper).ImageUpload.tsx,useImageUpload.ts, andSocialScreenSocialImage.tsx.ImageUpload.tsxsplits the try/catch so a completion-mutation failure reportsupload-mark-complete-failedinstead of mislabeling asupload-exception.setSuccess(true)deferred until after the mutation resolves.Tickets:
Test plan
apps/journeys-adminImageUpload.spec.tsx— 21/21 pass (adds mutation-failure spec)apps/journeys-adminuseImageUpload.spec.tsx— 10/10 passapps/journeys-adminSocialScreenSocialImage.spec.tsx— 7/7 passuploaded=truein the DB🤖 Generated with Claude Code