mobile: auto-refetch collection book IDs after invalidation#211
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.