Skip to content

mobile: auto-refetch collection book IDs after invalidation#211

Merged
mrviduus merged 1 commit into
mainfrom
fix/mobile-collection-refetch
May 5, 2026
Merged

mobile: auto-refetch collection book IDs after invalidation#211
mrviduus merged 1 commit into
mainfrom
fix/mobile-collection-refetch

Conversation

@mrviduus

@mrviduus mrviduus commented May 5, 2026

Copy link
Copy Markdown
Owner

Bug from PR #210 audit: when the active sidebar collection was selected and the user added a book to it, the new entry didn't appear in the filtered list. useCollections now exposes a versioned subscription; library.tsx adds it to the useEffect that fetches collection membership so invalidateCollectionsCache() triggers a refetch automatically.

Bug from PR #210 audit: when the active sidebar collection was already
selected and the user added a book to it from the kebab/detail sheet,
the new entry didn't appear in the filtered list — collectionFilterIds
was a one-shot fetch keyed only on activeCollectionId.

useCollections now bumps a global `version` counter on every cache
load and on invalidate. New `useCollectionsVersion()` exposes it as a
subscribable React state. (tabs)/library.tsx adds version to the
useEffect dep that fetches collection membership, so an
invalidateCollectionsCache() call from AddToCollectionSheet (or any
other future mutation) re-runs the fetch automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mrviduus mrviduus merged commit 2f976ce into main May 5, 2026
5 checks passed
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