diff --git a/examples/svelte/auto-refetching/package.json b/examples/svelte/auto-refetching/package.json
index 4c09dd93d4..735bd049aa 100644
--- a/examples/svelte/auto-refetching/package.json
+++ b/examples/svelte/auto-refetching/package.json
@@ -10,7 +10,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
- "@tanstack/svelte-query": "^5.0.0-alpha.38"
+ "@tanstack/svelte-query": "^5.0.0-alpha.38",
+ "@tanstack/svelte-query-devtools": "workspace:5.0.0-alpha.39"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
diff --git a/examples/svelte/auto-refetching/src/routes/+layout.svelte b/examples/svelte/auto-refetching/src/routes/+layout.svelte
index 8c686d17ed..ef60a2f559 100644
--- a/examples/svelte/auto-refetching/src/routes/+layout.svelte
+++ b/examples/svelte/auto-refetching/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
+ import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
const queryClient = new QueryClient({
defaultOptions: {
@@ -16,4 +17,5 @@
+
diff --git a/examples/svelte/auto-refetching/src/routes/+page.svelte b/examples/svelte/auto-refetching/src/routes/+page.svelte
index f30fdb7cbe..a72534d714 100644
--- a/examples/svelte/auto-refetching/src/routes/+page.svelte
+++ b/examples/svelte/auto-refetching/src/routes/+page.svelte
@@ -22,12 +22,12 @@
const addMutation = createMutation({
mutationFn: (value: string) =>
fetch(`${endpoint}?add=${value}`).then((r) => r.json()),
- onSuccess: () => client.invalidateQueries(['refetch']),
+ onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})
const clearMutation = createMutation({
mutationFn: () => fetch(`${endpoint}?clear=1`).then((r) => r.json()),
- onSuccess: () => client.invalidateQueries(['refetch']),
+ onSuccess: () => client.invalidateQueries({ queryKey: ['refetch'] }),
})
diff --git a/examples/svelte/auto-refetching/src/routes/api/data/+server.ts b/examples/svelte/auto-refetching/src/routes/api/data/+server.ts
index 5b12a9d23c..863c0feadf 100644
--- a/examples/svelte/auto-refetching/src/routes/api/data/+server.ts
+++ b/examples/svelte/auto-refetching/src/routes/api/data/+server.ts
@@ -1,6 +1,6 @@
import { json, type RequestHandler } from '@sveltejs/kit'
-let list = { items: ['Item 1', 'Item 2', 'Item 3'] }
+const list = { items: ['Item 1', 'Item 2', 'Item 3'] }
/** @type {import('./$types').RequestHandler} */
export const GET: RequestHandler = async ({ url }) => {
diff --git a/examples/svelte/basic/package.json b/examples/svelte/basic/package.json
index 3d7344f901..328f42485c 100644
--- a/examples/svelte/basic/package.json
+++ b/examples/svelte/basic/package.json
@@ -10,7 +10,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
- "@tanstack/svelte-query": "^5.0.0-alpha.38"
+ "@tanstack/svelte-query": "^5.0.0-alpha.38",
+ "@tanstack/svelte-query-devtools": "workspace:5.0.0-alpha.39"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
diff --git a/examples/svelte/basic/src/routes/+layout.svelte b/examples/svelte/basic/src/routes/+layout.svelte
index 8c686d17ed..ef60a2f559 100644
--- a/examples/svelte/basic/src/routes/+layout.svelte
+++ b/examples/svelte/basic/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
+ import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
const queryClient = new QueryClient({
defaultOptions: {
@@ -16,4 +17,5 @@
+
diff --git a/examples/svelte/load-more-infinite-scroll/package.json b/examples/svelte/load-more-infinite-scroll/package.json
index 24e8897f0a..c51d681a06 100644
--- a/examples/svelte/load-more-infinite-scroll/package.json
+++ b/examples/svelte/load-more-infinite-scroll/package.json
@@ -10,7 +10,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
- "@tanstack/svelte-query": "^5.0.0-alpha.38"
+ "@tanstack/svelte-query": "^5.0.0-alpha.38",
+ "@tanstack/svelte-query-devtools": "workspace:5.0.0-alpha.39"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
diff --git a/examples/svelte/load-more-infinite-scroll/src/lib/LoadMore.svelte b/examples/svelte/load-more-infinite-scroll/src/lib/LoadMore.svelte
index 2c12e71a5e..2fa7ce86fc 100644
--- a/examples/svelte/load-more-infinite-scroll/src/lib/LoadMore.svelte
+++ b/examples/svelte/load-more-infinite-scroll/src/lib/LoadMore.svelte
@@ -8,8 +8,8 @@
const query = createInfiniteQuery({
queryKey: ['planets'],
- queryFn: fetchPlanets,
- //@ts-ignore
+ queryFn: ({ pageParam }) => fetchPlanets({ pageParam }),
+ defaultPageParam: 1,
getNextPageParam: (lastPage) => {
if (lastPage.next) {
const nextUrl = new URLSearchParams(new URL(lastPage.next).search)
diff --git a/examples/svelte/load-more-infinite-scroll/src/routes/+layout.svelte b/examples/svelte/load-more-infinite-scroll/src/routes/+layout.svelte
index 8c686d17ed..ef60a2f559 100644
--- a/examples/svelte/load-more-infinite-scroll/src/routes/+layout.svelte
+++ b/examples/svelte/load-more-infinite-scroll/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
+ import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
const queryClient = new QueryClient({
defaultOptions: {
@@ -16,4 +17,5 @@
+
diff --git a/examples/svelte/optimistic-updates-typescript/package.json b/examples/svelte/optimistic-updates-typescript/package.json
index 4646994feb..b7f0879004 100644
--- a/examples/svelte/optimistic-updates-typescript/package.json
+++ b/examples/svelte/optimistic-updates-typescript/package.json
@@ -10,7 +10,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
- "@tanstack/svelte-query": "^5.0.0-alpha.38"
+ "@tanstack/svelte-query": "^5.0.0-alpha.38",
+ "@tanstack/svelte-query-devtools": "workspace:5.0.0-alpha.39"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
diff --git a/examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte b/examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte
index 8c686d17ed..ef60a2f559 100644
--- a/examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte
+++ b/examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
+ import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
const queryClient = new QueryClient({
defaultOptions: {
@@ -16,4 +17,5 @@
+
diff --git a/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte b/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte
index 5b6139410b..297c462b71 100644
--- a/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte
+++ b/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte
@@ -46,7 +46,7 @@
onMutate: async (newTodo: string) => {
text = ''
// Cancel any outgoing refetches (so they don't overwrite our optimistic update)
- await client.cancelQueries(['optimistic'])
+ await client.cancelQueries({ queryKey: ['optimistic'] })
// Snapshot the previous value
const previousTodos = client.getQueryData(['optimistic'])
@@ -72,7 +72,7 @@
},
// Always refetch after error or success:
onSettled: () => {
- client.invalidateQueries(['optimistic'])
+ client.invalidateQueries({ queryKey: ['optimistic'] })
},
})
diff --git a/examples/svelte/playground/package.json b/examples/svelte/playground/package.json
index c76cab8bab..9e9984597c 100644
--- a/examples/svelte/playground/package.json
+++ b/examples/svelte/playground/package.json
@@ -10,7 +10,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
- "@tanstack/svelte-query": "^5.0.0-alpha.38"
+ "@tanstack/svelte-query": "^5.0.0-alpha.38",
+ "@tanstack/svelte-query-devtools": "workspace:5.0.0-alpha.39"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
diff --git a/examples/svelte/playground/src/routes/+layout.svelte b/examples/svelte/playground/src/routes/+layout.svelte
index 8219a09ca9..1b9267032c 100644
--- a/examples/svelte/playground/src/routes/+layout.svelte
+++ b/examples/svelte/playground/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '../app.css'
import { browser } from '$app/environment'
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
+ import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
const queryClient = new QueryClient({
defaultOptions: {
@@ -20,4 +21,5 @@
+
diff --git a/examples/svelte/playground/src/routes/AddTodo.svelte b/examples/svelte/playground/src/routes/AddTodo.svelte
index 88a71b7cf3..09d94ca14d 100644
--- a/examples/svelte/playground/src/routes/AddTodo.svelte
+++ b/examples/svelte/playground/src/routes/AddTodo.svelte
@@ -12,7 +12,7 @@
let name = ''
- const postTodo = async ({ name, notes }) => {
+ const postTodo = async ({ name, notes }: { name: string; notes: string }) => {
console.info('postTodo', { name, notes })
return new Promise((resolve, reject) => {
setTimeout(() => {
@@ -41,7 +41,7 @@