Skip to content

fix(media): wire cloudflareUploadComplete across all upload surfaces [NES-1689]#9239

Draft
edmonday wants to merge 4 commits into
mainfrom
edmondshen/nes-1689-filter-getmycloudflareimages-to-uploadedtrue-and-call
Draft

fix(media): wire cloudflareUploadComplete across all upload surfaces [NES-1689]#9239
edmonday wants to merge 4 commits into
mainfrom
edmondshen/nes-1689-filter-getmycloudflareimages-to-uploadedtrue-and-call

Conversation

@edmonday
Copy link
Copy Markdown
Contributor

@edmonday edmonday commented May 21, 2026

Summary

Wires the cloudflareUploadComplete mutation into every journeys-admin file-upload surface so direct-file uploads flip CloudflareImage.uploaded to true. The companion BE filter on getMyCloudflareImages is split out to a follow-up ticket so historical orphan rows aren't silently hidden the moment the filter ships.

  • New useCloudflareUploadCompleteMutation lib hook (apps/journeys-admin/src/libs/) following the existing useCloudflareUploadByFileMutation pattern (hook + index + mock helper).
  • Wired into ImageUpload.tsx, useImageUpload.ts, and SocialScreenSocialImage.tsx.
  • ImageUpload.tsx splits the try/catch so a completion-mutation failure reports upload-mark-complete-failed instead of mislabeling as upload-exception. setSuccess(true) deferred until after the mutation resolves.

Tickets:

Test plan

  • apps/journeys-admin ImageUpload.spec.tsx — 21/21 pass (adds mutation-failure spec)
  • apps/journeys-admin useImageUpload.spec.tsx — 10/10 pass
  • apps/journeys-admin SocialScreenSocialImage.spec.tsx — 7/7 pass
  • QA: upload a file in each of the three surfaces and confirm the row appears with uploaded=true in the DB

🤖 Generated with Claude Code

…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>
@linear
Copy link
Copy Markdown

linear Bot commented May 21, 2026

NES-1689

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e2ef38f8-a58d-4813-9ed4-940d9177bffc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch edmondshen/nes-1689-filter-getmycloudflareimages-to-uploadedtrue-and-call

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 21, 2026

View your CI Pipeline Execution ↗ for commit fa5ef40

Command Status Duration Result
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 1s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 14s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 36s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-21 05:10:55 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Fails
🚫 Please request a reviewer for this PR.

Generated by 🚫 dangerJS against 993fac2

@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin May 21, 2026 04:02 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Thu May 21 17:10:55 NZST 2026

@edmonday edmonday self-assigned this May 21, 2026
… 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>
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin May 21, 2026 05:01 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin May 21, 2026 05:05 Pending
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>
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin May 21, 2026 05:09 Inactive
@edmonday edmonday changed the title fix(media): filter getMyCloudflareImages to uploaded:true and mark uploads complete [NES-1689] fix(media): wire cloudflareUploadComplete across all upload surfaces [NES-1689] May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant