Repository navigation
fix(web): wait for Save before removing a personal poster - #1918
Conversation
The personal manual form, the personal smart wizard and the synced-list editor deleted a collection's poster the moment its remove button was clicked, even if the person then left without saving. The admin editors already stage the removal until Save. The three personal editors now stage the removal the same way: the field shows no poster, the synced-list editor counts it as an unsaved change and Discard brings it back, and Save sends the PATCH and then the DELETE. A file or URL chosen after the removal replaces the poster and sends no DELETE, since the upload already clears the old image. saveCollectionPoster takes the staged removal, and the hook that deleted the poster at once is gone. The personal poster removal golden changes on purpose: it now records the PATCH followed by the DELETE. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a4992f8f7
ℹ️ 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".
| } | ||
| updateMutation.mutate( | ||
| { id: collection.id, etag, body, poster: posterFile }, | ||
| { id: collection.id, etag, body, poster: posterFile, removePoster: posterRemoved }, |
There was a problem hiding this comment.
Rebase the synced editor after saving poster removal
When a poster removal is saved in the synced-list editor, posterRemoved remains true while useScopeEditor deliberately retains the original collection and ETag. The page therefore continues to report an unsaved change; Discard makes the deleted poster reappear in the local preview, and another Save uses the stale ETag and receives a 412. After this mutation completes, close the editor or establish a new collection/ETag baseline and clear the staged removal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a29f5f1. After Save, the synced-list editor clears the staged removal and calls a new rebase() from useScopeEditor once the save's refetch lands, so it adopts the saved collection, its artwork and the new ETag. The save bar no longer counts the removal, Discard keeps the poster gone, and a second Save sends the current ETag. A test in CollectionImports.goldens.test.tsx covers all three; it failed before the fix.
|
Major change — #195 W5 (Web). Poster removal now stays staged in the editor and sends the existing DELETE only after Save's collection PATCH, changing the artwork-edit step. The PR must keep the reason for this intended behavior change explicit; the description does. W5 is Not run, so there is no prior pass to carry forward: complete the planned running-build walk before marking ready, then re-validate the changed flow after merge. Suggested fix: No diff; retain the current Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…x/personal-poster-removal-on-save
…r Save The personal synced-list editor stays open after Save but kept the collection and ETag it first loaded. After a staged poster removal saved, the save bar still counted it, Discard showed the deleted poster again, and a second Save sent the old ETag and got a 412. useScopeEditor now exposes rebase(). The synced-list editor clears the staged removal and calls it once the save and its refetch finish, so the page adopts the saved collection, its artwork and its new ETag. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Macroscope: the |
Problem
Related issue: #192
Validation tasks: changes #195 W5 (Not run; needs a walk on a running build before this PR is marked ready); reaches #194 A3 (Not run) and #193 S6 (Partial; no server change)
In the personal collection editors, removing the poster deletes it on the server at once, before Save. If the profile then leaves without saving, the poster is still gone. This affects the manual collection form, the smart collection editor and the synced-list editor. The admin editors already wait for Save. This PR makes the three personal editors wait for Save too.
Stacked on #1917 (
fix(web): refresh library Collections tabs after a personal collection changes).Approach
saveCollectionPoster(web/src/api/personalCollections.ts) runs the removal after the collection saves, anduseUpdateCollectionpasses it through. The poster failure toast now reads "Collection saved, but the poster wasn't updated: …" because it covers removals as well as uploads.useDeleteUserCollectionImage, the hook that deleted at once, has no callers left and is removed.rebase()onuseScopeEditor. Before, it kept the collection it first loaded, so a second Save got a 412 and Discard brought back values the save had replaced. This also applies to the other fields in that editor.personalPosterRemoval) is replaced on purpose by goldens for the staged removal: PATCH then DELETE for each editor, and PATCH then PUT for a file chosen after the removal.No API change: the image DELETE route takes no
If-Match, so it needs no ETag after the PATCH. jellycompat and the Apple and Android clients need no change. The user manual's collections page needs a line saying a poster removal takes effect on Save. That siloserver.org issue is not filed yet.Validation
tsc -bandmake test-webpass.make verify-local-pathspasses. No Go, contract or migration files changed, so the Go and contract checks were not run.make verify-case-collisionsdoes not exist on this base and was not run.Risks
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Defer personal collection poster deletion until Save
removePosterflag onuseUpdateCollectionand the updatedsaveCollectionPosterhelper in personalCollections.ts.useDeleteUserCollectionImagemutation and wires the same behavior into the manual form userCollectionsShared.tsx, the smart wizard SmartCollectionWizard.tsx, and the imported/synced-list editor ImportedCollectionEditor.tsx. Staged removal survives wizard step navigation.useScopeEditornow exposes a rebase callback so editors can adopt the saved collection and ETag after a save refetch.Macroscope summarized a29f5f1.