Repository navigation
fix(svelte-query): keep the QueriesObserver in createQueries when options change - #12746
turalbabayev wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 039d4c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🎯 Changes
In svelte-query,
createQueriescreated a newQueriesObserverthrough$derivedwhenever the options changed. The new observers subscribe again, so every query that already has data refetches on mount.With the dynamic example from the Svelte parallel queries guide, going from
users = [1]tousers = [1, 2]fetches user 1 again together with user 2. React'suseQueriesonly fetches user 2.The observer is now created once and only replaced when the client changes, the same as
createBaseQuery. Option changes already go throughsetQueries. It also passes{ combine }to the constructor instead of the bare function.Added a test that adds a query and checks the existing one isn't fetched again. It fails on main (3 calls instead of 2).
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request. (ran the svelte-query tests and svelte-check)🚀 Release Impact
Summary by CodeRabbit