Skip to content

fix(web): refresh library Collections tabs after a personal collection changes - #1917

Merged
Quick104 merged 2 commits into
feat/collections-revampfrom
fix/personal-collection-tab-refresh
Oct 4, 2026
Merged

Quick104 merged 2 commits into
feat/collections-revampfrom
fix/personal-collection-tab-refresh

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #192
Validation tasks: changes #195 W1, W2, W5, W7

When a profile changes a personal collection that has "Show in my library Collections tab" on, the library's Collections tab keeps showing the old version. A new collection, a rename, a delete, added or removed titles, a new order or a removed poster don't show there until the page reloads or the cached tab goes stale two minutes later. After these writes the web refreshed the profile's own collection lists and the catalog, but not the library tab. This PR refreshes the library tab too.

Stacked on #1914 (refactor(web): add the collection scope adapter and one set of type labels).

Approach

  • PERSONAL_SCOPE.invalidate (web/src/lib/collections/scope.ts) now also invalidates libraryCollectionKeys.all, the queries behind every library's Collections tab and its collection item lists. Personal create, update (including the Show to other profiles switch), delete, imports, sync and the 412 recovery paths already call it.
  • Adding or removing a title, reordering titles, reordering collections and removing a poster called invalidateUserCollectionQueries directly. They now call PERSONAL_SCOPE.invalidate, so they get the same refresh.

No API change. jellycompat and the Apple and Android clients need no change. No manual change.

Validation

  • Web: lint (no errors, no new warnings), format:check, build, budget:check, tsc -b and make test-web pass.
  • A new rendered test loads a library Collections tab next to the real personal update and delete hooks: after a rename the tab shows the new name, and after a delete the card disappears without a remount. Both failed before the fix.
  • A hook test per title, order and poster write checks that a loaded library tab is marked stale; each failed before the fix. The scope test now expects the library tab key.
  • Imports and sync have no rendered test of their own; they call the same PERSONAL_SCOPE.invalidate that the scope test covers.
  • 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.

Risks

  • Each personal write now also refetches any library Collections tab that is mounted at the time. Tabs that aren't on screen are only marked stale and refetch when they next open. Reordering titles triggers this once per completed move.

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 checked the diff against the redesign plan and confirmed that every personal create, update, delete, import, sync and 412 recovery path reaches PERSONAL_SCOPE.invalidate. In a throwaway copy it restored the base branch's scope.ts; the rendered tab tests and the scope test then failed. It found one minor problem: adding or removing titles, reordering and removing a poster still skipped the library tab, so a tab's item count and poster stayed stale. Those writes now go through PERSONAL_SCOPE.invalidate, with a test for each that failed before the change.

🤖 Generated with Claude Code

Note

Refresh library Collections tabs after personal collection changes

  • Makes PERSONAL_SCOPE.invalidate in scope.ts also invalidate the libraryCollections query-key root, so all library Collections-tab queries go stale after any personal collection write
  • Switches the personal paths in the mutation hooks in collections.ts (useAddItemToCollection, useRemoveCollectionItem, useReorderCollections, useReorderCollectionItems, useDeleteUserCollectionImage) to use this invalidation; library/admin paths keep admin invalidation
  • Adds tests in LibraryCollections.refresh.test.tsx that a personal collection rename or deletion updates the rendered library Collections tab without a page reload, plus hook-level invalidation coverage in collections.test.tsx
  • Behavioral Change: every successful personal collection mutation now triggers a library Collections-tab refetch; library collection mutations are unchanged

Macroscope summarized 2aac868.

Quick104 and others added 2 commits October 4, 2026 09:57
…n changes

A personal collection shown on the Collections tab is listed in each
library's tab, but saving, sharing, syncing or deleting it only refreshed
the profile's own collection keys, so the tab kept the old state until a
reload. The personal scope now also refreshes the library tab queries.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…der changes

Adding or removing a title, reordering, or removing a poster on a personal
collection left an already loaded library Collections tab showing the old
item count and poster until its cache went stale. These writes now go
through the personal scope's invalidation, like create, edit and 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-04T14:06:32.734493Z 2aac868 PR opened
ℹ️ 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: 57836c98-738e-405e-b880-e3f5421be635

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.

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

Validation tasks: understates the observable change. Personal writes now invalidate libraryCollectionKeys.all, so an opted-in personal collection's card (visibility, title, count, and poster) in a mounted library Collections tab refetches without a reload; an inactive tab refetches when opened. This is a minor change for #195 W1, W2, W5, and W7. All four cases are currently Not run, and the underlying ownership/access rules are unchanged.

This does not unblock W7's #1615 dependency or fix #1616's cross-profile ordering behavior. Please record these as changed cases and re-check the tab refresh path on a web build.

Suggested correction:

-Validation tasks: reaches #195 W1, W2, W5 and W7 (all Not run; refresh only, no re-walk needed)
+Validation tasks: changes #195 W1, W2, W5, W7

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

Posted via Macroscope — v1 validation impact

Base automatically changed from refactor/collection-scope-adapter to feat/collections-revamp October 4, 2026 19:52
@Quick104

Quick104 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Corrected the Validation tasks line to "changes #195 W1, W2, W5, W7" per the Macroscope note.

@Quick104
Quick104 merged commit 6f5e613 into feat/collections-revamp Oct 4, 2026
14 checks passed
@Quick104
Quick104 deleted the fix/personal-collection-tab-refresh branch October 4, 2026 20:04
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