Skip to content

Commit dac5da5

Browse files
docs(examples): Fix small errors in svelte examples (#7801)
1 parent ec8e800 commit dac5da5

File tree

22 files changed

+16
-16
lines changed

22 files changed

+16
-16
lines changed

docs/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,8 @@
990990
"to": "framework/svelte/examples/ssr"
991991
},
992992
{
993-
"label": "Optimistic Updates in TypeScript",
994-
"to": "framework/svelte/examples/optimistic-updates-typescript"
993+
"label": "Optimistic Updates",
994+
"to": "framework/svelte/examples/optimistic-updates"
995995
},
996996
{
997997
"label": "Playground",

examples/svelte/auto-refetching/src/routes/+page.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
} from '@tanstack/svelte-query'
77
88
let intervalMs = 1000
9-
let value: string
9+
let value = ''
1010
1111
const client = useQueryClient()
1212

examples/svelte/basic/src/lib/data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Post } from './types'
22

33
export const getPosts = async (limit: number) => {
44
const response = await fetch('https://jsonplaceholder.typicode.com/posts')
5-
const data = (await response.json()) as Post[]
5+
const data = (await response.json()) as Array<Post>
66
return data.filter((x) => x.id <= limit)
77
}
88

examples/svelte/load-more-infinite-scroll/src/app.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ h1 {
4141
padding: 2em;
4242
}
4343

44-
#app {
44+
main {
4545
max-width: 1280px;
4646
margin: 0 auto;
4747
padding: 2rem;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<script>
1+
<script lang="ts">
22
import LoadMore from '../lib/LoadMore.svelte'
33
</script>
44

5-
<h1>Infinte Load More</h1>
5+
<h1>Infinite Load More</h1>
66
<LoadMore />

examples/svelte/optimistic-updates-typescript/package.json renamed to examples/svelte/optimistic-updates/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tanstack/query-example-svelte-optimistic-updates-typescript",
2+
"name": "@tanstack/query-example-svelte-optimistic-updates",
33
"private": true,
44
"type": "module",
55
"scripts": {

examples/svelte/optimistic-updates-typescript/src/routes/+page.svelte renamed to examples/svelte/optimistic-updates/src/routes/+page.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ts: number
1717
}
1818
19-
let text: string
19+
let text = ''
2020
2121
const client = useQueryClient()
2222

examples/svelte/simple/src/lib/Simple.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { createQuery } from '@tanstack/svelte-query'
33
44
type Repo = {
5-
name: string
5+
full_name: string
66
description: string
77
subscribers_count: number
88
stargazers_count: number
@@ -12,8 +12,8 @@
1212
const query = createQuery<Repo>({
1313
queryKey: ['repoData'],
1414
queryFn: async () =>
15-
await fetch('https://api.github.com/repos/SvelteStack/svelte-query').then(
16-
(r) => r.json(),
15+
await fetch('https://api.github.com/repos/TanStack/query').then((r) =>
16+
r.json(),
1717
),
1818
})
1919
</script>
@@ -30,7 +30,7 @@
3030
{/if}
3131
{#if $query.isSuccess}
3232
<div>
33-
<h1>{$query.data.name}</h1>
33+
<h1>{$query.data.full_name}</h1>
3434
<p>{$query.data.description}</p>
3535
<strong>👀 {$query.data.subscribers_count}</strong>{' '}
3636
<strong>✨ {$query.data.stargazers_count}</strong>{' '}

examples/svelte/simple/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import './app.css'
22
import App from './App.svelte'
33

44
const app = new App({
5-
target: document.getElementById('app')!,
5+
target: document.querySelector('#app')!,
66
})
77

88
export default app

examples/svelte/ssr/src/lib/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const api = (customFetch = fetch) => ({
55
const response = await customFetch(
66
'https://jsonplaceholder.typicode.com/posts',
77
)
8-
const data = (await response.json()) as Post[]
8+
const data = (await response.json()) as Array<Post>
99
return data.filter((x) => x.id <= limit)
1010
},
1111
getPostById: async (id: number): Promise<Post> => {

pnpm-lock.yaml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)