fix: refresh sidebar counts after photo mutations
LIBRARY_STATS_QUERY_KEY was never invalidated by the bulk/single mutation paths in RightSidebar and PhotoInfoPanel, so the All Photos / Rated / Discarded / Tags badges only updated on reload. Add it to both shared invalidation helpers and the inline updateMutation, and correct the stale docstring on useLibraryStatsQuery. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,9 @@ export const LIBRARY_STATS_QUERY_KEY = ['library', 'stats'] as const
|
||||
/**
|
||||
* Per-section counts for the LeftSidebar badges (All Photos, Rated,
|
||||
* Duplicates, Discarded). Cached briefly so navigating around doesn't
|
||||
* re-fetch on every click; invalidated on photo mutations through the
|
||||
* standard ['photos'] invalidation in the mutation onSuccess paths.
|
||||
* re-fetch on every click. Mutations that change a photo's rating,
|
||||
* discard flag, tags, etc. must invalidate LIBRARY_STATS_QUERY_KEY in
|
||||
* their onSuccess so the badges stay live.
|
||||
*/
|
||||
export function useLibraryStatsQuery() {
|
||||
return useQuery<LibraryStats>({
|
||||
|
||||
Reference in New Issue
Block a user