diff --git a/docs/config.json b/docs/config.json index 2bf9b064b6..9acb50a2e0 100644 --- a/docs/config.json +++ b/docs/config.json @@ -990,8 +990,8 @@ "to": "framework/svelte/examples/ssr" }, { - "label": "Optimistic Updates in TypeScript", - "to": "framework/svelte/examples/optimistic-updates-typescript" + "label": "Optimistic Updates", + "to": "framework/svelte/examples/optimistic-updates" }, { "label": "Playground", diff --git a/examples/svelte/auto-refetching/src/routes/+page.svelte b/examples/svelte/auto-refetching/src/routes/+page.svelte index b395580cd0..e9d5c21d5d 100644 --- a/examples/svelte/auto-refetching/src/routes/+page.svelte +++ b/examples/svelte/auto-refetching/src/routes/+page.svelte @@ -6,7 +6,7 @@ } from '@tanstack/svelte-query' let intervalMs = 1000 - let value: string + let value = '' const client = useQueryClient() diff --git a/examples/svelte/basic/src/lib/data.ts b/examples/svelte/basic/src/lib/data.ts index eed8ecbb1d..47dda34982 100644 --- a/examples/svelte/basic/src/lib/data.ts +++ b/examples/svelte/basic/src/lib/data.ts @@ -2,7 +2,7 @@ import type { Post } from './types' export const getPosts = async (limit: number) => { const response = await fetch('https://jsonplaceholder.typicode.com/posts') - const data = (await response.json()) as Post[] + const data = (await response.json()) as Array return data.filter((x) => x.id <= limit) } diff --git a/examples/svelte/load-more-infinite-scroll/src/app.css b/examples/svelte/load-more-infinite-scroll/src/app.css index bcc7233dd1..c57658b1ef 100644 --- a/examples/svelte/load-more-infinite-scroll/src/app.css +++ b/examples/svelte/load-more-infinite-scroll/src/app.css @@ -41,7 +41,7 @@ h1 { padding: 2em; } -#app { +main { max-width: 1280px; margin: 0 auto; padding: 2rem; diff --git a/examples/svelte/load-more-infinite-scroll/src/routes/+page.svelte b/examples/svelte/load-more-infinite-scroll/src/routes/+page.svelte index 14c2b4abbd..42dac06c40 100644 --- a/examples/svelte/load-more-infinite-scroll/src/routes/+page.svelte +++ b/examples/svelte/load-more-infinite-scroll/src/routes/+page.svelte @@ -1,6 +1,6 @@ - -

Infinte Load More

+

Infinite Load More

diff --git a/examples/svelte/optimistic-updates-typescript/.gitignore b/examples/svelte/optimistic-updates/.gitignore similarity index 100% rename from examples/svelte/optimistic-updates-typescript/.gitignore rename to examples/svelte/optimistic-updates/.gitignore diff --git a/examples/svelte/optimistic-updates-typescript/README.md b/examples/svelte/optimistic-updates/README.md similarity index 100% rename from examples/svelte/optimistic-updates-typescript/README.md rename to examples/svelte/optimistic-updates/README.md diff --git a/examples/svelte/optimistic-updates-typescript/package.json b/examples/svelte/optimistic-updates/package.json similarity index 88% rename from examples/svelte/optimistic-updates-typescript/package.json rename to examples/svelte/optimistic-updates/package.json index 64cb13e63d..f15a3efd2e 100644 --- a/examples/svelte/optimistic-updates-typescript/package.json +++ b/examples/svelte/optimistic-updates/package.json @@ -1,5 +1,5 @@ { - "name": "@tanstack/query-example-svelte-optimistic-updates-typescript", + "name": "@tanstack/query-example-svelte-optimistic-updates", "private": true, "type": "module", "scripts": { diff --git a/examples/svelte/optimistic-updates-typescript/src/app.css b/examples/svelte/optimistic-updates/src/app.css similarity index 100% rename from examples/svelte/optimistic-updates-typescript/src/app.css rename to examples/svelte/optimistic-updates/src/app.css diff --git a/examples/svelte/optimistic-updates-typescript/src/app.d.ts b/examples/svelte/optimistic-updates/src/app.d.ts similarity index 100% rename from examples/svelte/optimistic-updates-typescript/src/app.d.ts rename to examples/svelte/optimistic-updates/src/app.d.ts diff --git a/examples/svelte/optimistic-updates-typescript/src/app.html b/examples/svelte/optimistic-updates/src/app.html similarity index 100% rename from examples/svelte/optimistic-updates-typescript/src/app.html rename to examples/svelte/optimistic-updates/src/app.html diff --git a/examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte b/examples/svelte/optimistic-updates/src/routes/+layout.svelte similarity index 100% rename from examples/svelte/optimistic-updates-typescript/src/routes/+layout.svelte rename to examples/svelte/optimistic-updates/src/routes/+layout.svelte diff --git a/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte b/examples/svelte/optimistic-updates/src/routes/+page.svelte similarity index 99% rename from examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte rename to examples/svelte/optimistic-updates/src/routes/+page.svelte index 297c462b71..af8738ffcc 100644 --- a/examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte +++ b/examples/svelte/optimistic-updates/src/routes/+page.svelte @@ -16,7 +16,7 @@ ts: number } - let text: string + let text = '' const client = useQueryClient() diff --git a/examples/svelte/optimistic-updates-typescript/src/routes/api/data/+server.ts b/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts similarity index 100% rename from examples/svelte/optimistic-updates-typescript/src/routes/api/data/+server.ts rename to examples/svelte/optimistic-updates/src/routes/api/data/+server.ts diff --git a/examples/svelte/optimistic-updates-typescript/static/favicon.png b/examples/svelte/optimistic-updates/static/favicon.png similarity index 100% rename from examples/svelte/optimistic-updates-typescript/static/favicon.png rename to examples/svelte/optimistic-updates/static/favicon.png diff --git a/examples/svelte/optimistic-updates-typescript/svelte.config.js b/examples/svelte/optimistic-updates/svelte.config.js similarity index 100% rename from examples/svelte/optimistic-updates-typescript/svelte.config.js rename to examples/svelte/optimistic-updates/svelte.config.js diff --git a/examples/svelte/optimistic-updates-typescript/tsconfig.json b/examples/svelte/optimistic-updates/tsconfig.json similarity index 100% rename from examples/svelte/optimistic-updates-typescript/tsconfig.json rename to examples/svelte/optimistic-updates/tsconfig.json diff --git a/examples/svelte/optimistic-updates-typescript/vite.config.ts b/examples/svelte/optimistic-updates/vite.config.ts similarity index 100% rename from examples/svelte/optimistic-updates-typescript/vite.config.ts rename to examples/svelte/optimistic-updates/vite.config.ts diff --git a/examples/svelte/simple/src/lib/Simple.svelte b/examples/svelte/simple/src/lib/Simple.svelte index dd4b74ca8a..6b044dc321 100644 --- a/examples/svelte/simple/src/lib/Simple.svelte +++ b/examples/svelte/simple/src/lib/Simple.svelte @@ -2,7 +2,7 @@ import { createQuery } from '@tanstack/svelte-query' type Repo = { - name: string + full_name: string description: string subscribers_count: number stargazers_count: number @@ -12,8 +12,8 @@ const query = createQuery({ queryKey: ['repoData'], queryFn: async () => - await fetch('https://api.github.com/repos/SvelteStack/svelte-query').then( - (r) => r.json(), + await fetch('https://api.github.com/repos/TanStack/query').then((r) => + r.json(), ), }) @@ -30,7 +30,7 @@ {/if} {#if $query.isSuccess}
-

{$query.data.name}

+

{$query.data.full_name}

{$query.data.description}

👀 {$query.data.subscribers_count}{' '} ✨ {$query.data.stargazers_count}{' '} diff --git a/examples/svelte/simple/src/main.ts b/examples/svelte/simple/src/main.ts index 4d67e2ac2a..7ad46094a0 100644 --- a/examples/svelte/simple/src/main.ts +++ b/examples/svelte/simple/src/main.ts @@ -2,7 +2,7 @@ import './app.css' import App from './App.svelte' const app = new App({ - target: document.getElementById('app')!, + target: document.querySelector('#app')!, }) export default app diff --git a/examples/svelte/ssr/src/lib/api.ts b/examples/svelte/ssr/src/lib/api.ts index 278c1dd6c5..b75c993437 100644 --- a/examples/svelte/ssr/src/lib/api.ts +++ b/examples/svelte/ssr/src/lib/api.ts @@ -5,7 +5,7 @@ export const api = (customFetch = fetch) => ({ const response = await customFetch( 'https://jsonplaceholder.typicode.com/posts', ) - const data = (await response.json()) as Post[] + const data = (await response.json()) as Array return data.filter((x) => x.id <= limit) }, getPostById: async (id: number): Promise => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7161426b01..a7dda5fb31 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1355,7 +1355,7 @@ importers: specifier: ^5.3.3 version: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1) - examples/svelte/optimistic-updates-typescript: + examples/svelte/optimistic-updates: dependencies: '@tanstack/svelte-query': specifier: ^5.51.15