Skip to content

Commit

Permalink
docs(examples): Fix small errors in svelte examples (#7801)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Jul 27, 2024
1 parent ec8e800 commit dac5da5
Show file tree
Hide file tree
Showing 22 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/auto-refetching/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
} from '@tanstack/svelte-query'
let intervalMs = 1000
let value: string
let value = ''
const client = useQueryClient()
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/basic/src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Post>
return data.filter((x) => x.id <= limit)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/load-more-infinite-scroll/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ h1 {
padding: 2em;
}

#app {
main {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
<script lang="ts">
import LoadMore from '../lib/LoadMore.svelte'
</script>

<h1>Infinte Load More</h1>
<h1>Infinite Load More</h1>
<LoadMore />
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@tanstack/query-example-svelte-optimistic-updates-typescript",
"name": "@tanstack/query-example-svelte-optimistic-updates",
"private": true,
"type": "module",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ts: number
}
let text: string
let text = ''
const client = useQueryClient()
Expand Down
8 changes: 4 additions & 4 deletions examples/svelte/simple/src/lib/Simple.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -12,8 +12,8 @@
const query = createQuery<Repo>({
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(),
),
})
</script>
Expand All @@ -30,7 +30,7 @@
{/if}
{#if $query.isSuccess}
<div>
<h1>{$query.data.name}</h1>
<h1>{$query.data.full_name}</h1>
<p>{$query.data.description}</p>
<strong>👀 {$query.data.subscribers_count}</strong>{' '}
<strong>✨ {$query.data.stargazers_count}</strong>{' '}
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/simple/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/svelte/ssr/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Post>
return data.filter((x) => x.id <= limit)
},
getPostById: async (id: number): Promise<Post> => {
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dac5da5

Please sign in to comment.