diff --git a/docs/config.json b/docs/config.json index f5324984ee..d79c1e77ed 100644 --- a/docs/config.json +++ b/docs/config.json @@ -127,10 +127,6 @@ { "label": "SSR & SvelteKit", "to": "framework/svelte/ssr" - }, - { - "label": "Reactivity", - "to": "framework/svelte/reactivity" } ] }, diff --git a/docs/framework/svelte/devtools.md b/docs/framework/svelte/devtools.md index 0969b7d004..efdb77e922 100644 --- a/docs/framework/svelte/devtools.md +++ b/docs/framework/svelte/devtools.md @@ -61,7 +61,7 @@ Place the following code as high in your Svelte app as you can. The closer it is ### Options -- `initialIsOpen: Boolean` +- `initialIsOpen: boolean` - Set this `true` if you want the dev tools to default to being open - `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "relative"` - Defaults to `bottom-right` diff --git a/docs/framework/svelte/installation.md b/docs/framework/svelte/installation.md index e4ad607ee0..7fd45eb7df 100644 --- a/docs/framework/svelte/installation.md +++ b/docs/framework/svelte/installation.md @@ -5,8 +5,6 @@ title: Installation You can install Svelte Query via [NPM](https://npmjs.com). -> v5 is currently available as a release-candidate. We don't anticipate any major API changes from here on out. We encourage you to try it out and report any issues you find. - ### NPM ```bash diff --git a/docs/framework/svelte/overview.md b/docs/framework/svelte/overview.md index f1122355aa..e2cc39531e 100644 --- a/docs/framework/svelte/overview.md +++ b/docs/framework/svelte/overview.md @@ -28,19 +28,19 @@ Then call any function (e.g. createQuery) from any component:
Loading...
- {:else if $query.isError} -Error: {$query.error.message}
- {:else if $query.isSuccess} - {#each $query.data as todo} + {:else if query.isError} +Error: {query.error.message}
+ {:else if query.isSuccess} + {#each query.data as todo}{todo.title}
{/each} {/if} @@ -62,6 +62,8 @@ Svelte Query offers useful functions and components that will make managing serv - `useQueryClient` - `useIsFetching` - `useIsMutating` +- `useMutationState` +- `useIsRestoring` - `useHydrate` - `This example is best experienced on your own machine, where you can open @@ -49,8 +51,8 @@ margin-left:.5rem; width:.75rem; height:.75rem; - background: {$todos.isFetching ? 'green' : 'transparent'}; - transition: {!$todos.isFetching ? 'all .3s ease' : 'none'}; + background: {todos.isFetching ? 'green' : 'transparent'}; + transition: {!todos.isFetching ? 'all .3s ease' : 'none'}; border-radius: 100%; transform: scale(1.5)" > @@ -58,10 +60,10 @@
Background Updating...+ diff --git a/examples/svelte/auto-refetching/svelte.config.js b/examples/svelte/auto-refetching/svelte.config.js index 2dee2d78a1..d6b43b0085 100644 --- a/examples/svelte/auto-refetching/svelte.config.js +++ b/examples/svelte/auto-refetching/svelte.config.js @@ -3,13 +3,13 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors preprocess: vitePreprocess(), - kit: { adapter: adapter(), }, + compilerOptions: { + runes: true, + }, } export default config diff --git a/examples/svelte/basic/src/lib/Post.svelte b/examples/svelte/basic/src/lib/Post.svelte index 56472ce68f..49469c2fb5 100644 --- a/examples/svelte/basic/src/lib/Post.svelte +++ b/examples/svelte/basic/src/lib/Post.svelte @@ -3,29 +3,29 @@ import { getPostById } from './data' import type { Post } from './types' - export let postId: number + const { postId }: { postId: number } = $props() - const post = createQuery
{$post.data.body}
+{post.data.body}
Background Updating...{/if}
{$query.data.description}
- 👀 {$query.data.subscribers_count}{' '} - ✨ {$query.data.stargazers_count}{' '} - 🍴 {$query.data.forks_count} +{query.data.description}
+ 👀 {query.data.subscribers_count}{' '} + ✨ {query.data.stargazers_count}{' '} + 🍴 {query.data.forks_count}{$post.data.body}
+{post.data.body}
Background Updating...{/if}
Using the Star Wars API
- (Built by @Brent_m_Clark - ) + (Built by @Brent_m_Clark)
Loading...
{/if} -{#if $query.status === 'error'} +{#if query.status === 'error'}Error :(
{/if} -{#if $query.status === 'success'} +{#if query.status === 'success'}Loading...
{/if} -{#if $query.status === 'error'} +{#if query.status === 'error'}Error :(
{/if} -{#if $query.status === 'success'} - {@const homeworldUrlParts = $query.data.homeworld.split('/').filter(Boolean)} +{#if query.status === 'success'} + {@const homeworldUrlParts = query.data.homeworld.split('/').filter(Boolean)} {@const homeworldId = homeworldUrlParts[homeworldUrlParts.length - 1]}Born | -{$query.data.birth_year} | +{query.data.birth_year} |
Eyes | -{$query.data.eye_color} | +{query.data.eye_color} |
Hair | -{$query.data.hair_color} | +{query.data.hair_color} |
Height | -{$query.data.height} | +{query.data.height} |
Mass | -{$query.data.mass} | +{query.data.mass} |
Homeworld | @@ -68,7 +66,7 @@
Loading...
{/if} -{#if $query.status === 'error'} +{#if query.status === 'error'}Error :(
{/if} -{#if $query.status === 'success'} +{#if query.status === 'success'}Loading...
{/if} -{#if $query.status === 'error'} +{#if query.status === 'error'}Error :(
{/if} -{#if $query.status === 'success'} +{#if query.status === 'success'}{$query.data.opening_crawl}
+{query.data.opening_crawl}