mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
Which queries a mutation makes stale was knowledge each caller carried: 139 invalidateQueries calls in 48 files listed keys by hand, the lists differed, and some used hand-written prefix keys such as ['sync-matrix'] that queryKeys could not express. The key list of every event now lives once in lib/queryEvents.ts and call sites say what happened: invalidate(queryClient, 'skillsUninstalled'). The three existing helpers (invalidateAfterSync, refreshTargets, refreshInstructions) became events too. queryKeys gained the prefix keys (syncMatrixAll, diffAll, logAll, logStatsAll) and every query key that was written inline, so no key literal remains outside queryKeys.ts. No call site's invalidated set changed. Each event is tested once against a real QueryClient, including which queries it reaches by prefix. Refs #445