Repository navigation
Conversation
…ate the list once on 'clear' and 'removeQueries'
🦋 Changeset detectedLatest commit: 5884b78 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
View your CI Pipeline Execution ↗ for commit 5884b78
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 25 bumped as dependents. 🟩 Patch bumps
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
size-limit report 📦
|
… clear query cache button
…once instead of per event
🎯 Changes
setupQueryCacheSubscription. Each event queues the matching subscription updates by subscription id, and a single microtask runs them all inside one Solidbatch.queryClient.clear()andqueryClient.removeQueries()remove queries one by one and emit aremovedevent for each, so the query list was recomputed and re-rendered once per removed query when app code called them. Now the list updates once. Every subscription callback reads the cache when it runs, so skipping the intermediate events doesn't change the result.batcharoundquery_cache().clear()in the clear cache button handler. The coalesced updates already run in onebatch, so it no longer does anything.scheduleincreateCacheSubscriptionRegistry'snotify, so repeated updates of the same subscription can be merged.queryClient.clear()with 1000 queries andqueryClient.removeQueries()for 500 of them, and check that the list content'sstylechanges once. Without the fix it changes 1000 and 500 times.Measured in Chromium with a production build of
examples/react/simple(using@tanstack/react-query-devtools/production), timing a directqueryClient.clear()/queryClient.removeQueries()call until the devtools update finishes, 3 runs each:clear(), 250 queriesclear(), 1000 queriesclear(), 2000 queriesremoveQueries()half, 1000 queriesremoveQueries()half, 2000 queries✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit