Repository navigation
Conversation
…aling an 'Activity' does not fetch the previous key
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…aling an 'Activity' does not fetch the previous key
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
🎯 Changes
Fixes #12227.
When the query key changes inside a hidden
<Activity>, the effects only run again on reveal, in declaration order. The subscription came first, soonSubscribefetched the observer's old query beforesetOptionsmoved it to the new key. I moved thesetOptionseffect (andsetQueriesinuseQueries) aboveuseSyncExternalStore.setOptionsdoesn't fetch while there are no listeners, so the subscription now starts on the current key. The same thing happened whensubscribedorisRestoringflipped in the same render as a key change, which is how it shows up in Preact, so I changed it there too.The
PersistQueryClientProvidertests now see one render fewer when restoring finishes. The dropped render was an exact copy of the one before it.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit
<Activity>trees so revealing them fetches and displays data for the current query key instead of the previous one.