web: svelte-query 6 — queries are reactive objects read directly, not stores (#8532)
release / go (push) Failing after 1m10s
release / web (push) Failing after 10s
release / android (push) Failing after 1m2s
release / govulncheck (push) Successful in 17s
release / integration (push) Successful in 2m31s
release / Build signed APK (push) Failing after 1m43s
release / Build + push container image (push) Skipped

@tanstack/svelte-query 6 is built on runes:
- createQuery and createInfiniteQuery take their options as a function
  and return a reactive object that components read as query.data.
- createMutation takes its options the same way.

What this commit changes:
- Every query creator in src/lib/api now takes its arguments as getters
  and reads them inside the options, so a query follows the values it
  depends on. Before, each component rebuilt it in a $derived.
- Constant arguments are passed as getters too, so the rule has no
  exceptions.
- Components call a creator once at init: const query =
  createArtistQuery(() => id). The $derived(create…) and $store pairs
  are gone.
- A query that loads only on demand (a chosen genre or year, the
  Handled view) has an enabled getter. The page keeps its `cond ? q :
  null` alias, because a switched-off query reports isPending and the
  page expects null when nothing is chosen.
- Tests: the query mocks return plain objects. liveQuery
  (test-utils/liveQuery.svelte.ts) gives a test a result it can change
  mid-test. Argument checks call the getter the page passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 10:55:05 -05:00
co-authored by Claude Opus 5.5
parent 936c0cd3ec
commit be384c8efe
75 changed files with 350 additions and 382 deletions
+9 -9
View File
@@ -10,7 +10,7 @@
"dependencies": {
"@lucide/svelte": "^1.87.0",
"@neodrag/svelte": "^2.3.3",
"@tanstack/svelte-query": "^5.90.2"
"@tanstack/svelte-query": "^6.4.7"
},
"devDependencies": {
"@sveltejs/adapter-static": "^4.0.0",
@@ -828,27 +828,27 @@
}
},
"node_modules/@tanstack/query-core": {
"version": "5.90.2",
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.2.tgz",
"integrity": "sha512-k/TcR3YalnzibscALLwxeiLUub6jN5EDLwKDiO7q5f4ICEoptJ+n9+7vcEFy5/x/i6Q+Lb/tXrsKCggf5uQJXQ==",
"version": "5.108.4",
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.108.4.tgz",
"integrity": "sha512-2Ks5dlLWz4eXJrthOyG0qW3SLt3xx0RrQmAmN0rnmogiaaOYuWiAe6HAm9KE2b2v8nig+vraNz8fsfZ6fF6zFg==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
}
},
"node_modules/@tanstack/svelte-query": {
"version": "5.90.2",
"resolved": "https://registry.npmjs.org/@tanstack/svelte-query/-/svelte-query-5.90.2.tgz",
"integrity": "sha512-owjnp0w8sOXlMhLZhucHrsYvCjgjHrVyII/wlqMGefxKFyroZS3xCwTee+IUx7UHbL+QmKr/HQTeTqhgxmxPQw==",
"version": "6.4.7",
"resolved": "https://registry.npmjs.org/@tanstack/svelte-query/-/svelte-query-6.4.7.tgz",
"integrity": "sha512-PkKz/OXE+BGb5rsrepDElCiXaVjq7Q4POKrvo27n5dg1yKhso7P3s/uScBmci5gTyMUac7b2n6LWkl0c9KRhAQ==",
"dependencies": {
"@tanstack/query-core": "5.90.2"
"@tanstack/query-core": "5.108.4"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"svelte": "^3.54.0 || ^4.0.0 || ^5.0.0"
"svelte": "^5.25.0"
}
},
"node_modules/@testing-library/dom": {