Skip to content

fix(web): wait for Save before removing a personal poster - #1918

Merged
Quick104 merged 3 commits into
feat/collections-revampfrom
fix/personal-poster-removal-on-save
Oct 4, 2026
Merged

Quick104 merged 3 commits into
feat/collections-revampfrom
fix/personal-poster-removal-on-save

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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

  • After the remove click, the poster field shows the upload area instead of the old poster. Nothing is sent until Save, which sends the collection PATCH and then the poster DELETE. Leaving the page, or pressing Discard in the synced-list editor, sends nothing.
  • Choosing a file or a URL after the removal cancels it. Save uploads the new poster and sends no DELETE, because the upload already replaces the old image (fix(collections): give replaced collection artwork a new URL #1326).
  • The removal follows the same rules as the admin editors. In the smart editor it stays in place when moving between the Filters and Details steps. In the synced-list editor it counts as an unsaved change.
  • saveCollectionPoster (web/src/api/personalCollections.ts) runs the removal after the collection saves, and useUpdateCollection passes 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.
  • The synced-list editor stays open after Save. It now adopts the saved collection and its new ETag once the save finishes, through a new rebase() on useScopeEditor. 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.
  • Markup and copy are otherwise unchanged.
  • The request golden from test(web): pin what the collection pages and editors save today #1912 that pinned the immediate DELETE (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

  • Web: lint (no errors; the changed files have the same warnings as before), format:check, build, budget:check, tsc -b and make test-web pass.
  • New tests cover the API helper (one DELETE after the save, an upload in the same save wins over the DELETE, a failed DELETE keeps the saved collection and reports the error) and each of the three editors: leaving or Discard after a removal sends nothing, Save sends PATCH then DELETE, and the smart editor keeps the removal across steps. They failed before the fix, which deleted the poster at once.
  • Another test covers the synced-list editor after Save: no unsaved change is counted, Discard keeps the poster gone, and a second Save sends the current ETag.
  • make verify-local-paths passes. No Go, contract or migration files changed, so the Go and contract checks were not run. make verify-case-collisions does not exist on this base and was not run.
  • Collections — Web #195 W5 has not been walked on a running build.

Risks

  • If the poster DELETE fails after the collection saves, the error toast is the only sign; the editor then shows the poster the server still has.
  • If the refetch after a synced-list save fails, the editor keeps the copy it had, as before this PR.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent compared the diff with the redesign plan and with the admin editors' existing staged removal. It checked every caller of the changed save path and confirmed the image DELETE route needs no ETag. In a throwaway copy with the five changed source files reverted, 9 of the new tests failed. It approved with one minor finding: the synced-list editor still counts an unsaved change after Save, as described under Risks. A Codex review raised the same problem; the editor now adopts the saved collection after Save, with a test that failed before the change.

🤖 Generated with Claude Code

Note

Defer personal collection poster deletion until Save

  • Poster removal in personal collection editors is now staged locally. The collection PATCH runs first, then the poster image DELETE, via a removePoster flag on useUpdateCollection and the updated saveCollectionPoster helper in personalCollections.ts.
  • Replacing the poster with a file or URL cancels the staged removal. Discard or leaving without saving sends no deletion request.
  • Removes the standalone useDeleteUserCollectionImage mutation 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.
  • useScopeEditor now exposes a rebase callback so editors can adopt the saved collection and ETag after a save refetch.
  • Behavioral Change: post-save toast wording changes to 'poster was not updated' when poster deletion fails; the editor no longer deletes the image immediately when Delete image is clicked.

Macroscope summarized a29f5f1.

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T20:13:07.907816Z a29f5f1 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd37e69a-3a6a-4de7-b180-330c7df682d5

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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

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 Validation tasks: line and record the build-specific result when available.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Base automatically changed from fix/personal-collection-tab-refresh to feat/collections-revamp October 4, 2026 20:04
Quick104 and others added 2 commits October 4, 2026 16:06
…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]>
@Quick104

Quick104 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Macroscope: the Validation tasks: line stays as written; #195 W5 is still Not run and gets its walk on a running build.

@macroscopeapp

This comment has been minimized.

@Quick104
Quick104 merged commit faa3ae3 into feat/collections-revamp Oct 4, 2026
17 checks passed
@Quick104
Quick104 deleted the fix/personal-poster-removal-on-save branch October 4, 2026 20:26
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