Skip to content

Commit 2f82fa9

Browse files
authored
Merge branch 'main' into feature/environmentManager
2 parents 6c78f60 + 8a59b2d commit 2f82fa9

92 files changed

Lines changed: 3527 additions & 810 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/config.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@
183183
"label": "Quick Start",
184184
"to": "framework/preact/quick-start"
185185
},
186+
{
187+
"label": "Devtools",
188+
"to": "framework/preact/devtools"
189+
},
186190
{
187191
"label": "TypeScript",
188192
"to": "framework/preact/typescript"
@@ -1144,6 +1148,10 @@
11441148
{
11451149
"label": "Functions / infiniteQueryOptions",
11461150
"to": "framework/svelte/reference/functions/infiniteQueryOptions"
1151+
},
1152+
{
1153+
"label": "Functions / mutationOptions",
1154+
"to": "framework/svelte/reference/functions/mutationOptions"
11471155
}
11481156
]
11491157
},
@@ -1593,6 +1601,31 @@
15931601
"to": "framework/vue/plugins/createPersister"
15941602
}
15951603
]
1604+
},
1605+
{
1606+
"label": "preact",
1607+
"children": [
1608+
{
1609+
"label": "persistQueryClient",
1610+
"to": "framework/preact/plugins/persistQueryClient"
1611+
},
1612+
{
1613+
"label": "createSyncStoragePersister",
1614+
"to": "framework/preact/plugins/createSyncStoragePersister"
1615+
},
1616+
{
1617+
"label": "createAsyncStoragePersister",
1618+
"to": "framework/preact/plugins/createAsyncStoragePersister"
1619+
},
1620+
{
1621+
"label": "broadcastQueryClient (Experimental)",
1622+
"to": "framework/preact/plugins/broadcastQueryClient"
1623+
},
1624+
{
1625+
"label": "createPersister (Experimental)",
1626+
"to": "framework/preact/plugins/createPersister"
1627+
}
1628+
]
15961629
}
15971630
]
15981631
}

docs/framework/preact/devtools.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
id: devtools
3+
title: Devtools
4+
---
5+
6+
Wave your hands in the air and shout hooray because Preact Query comes with dedicated devtools! 🥳
7+
8+
When you begin your Preact Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Preact Query and will likely save you hours of debugging if you find yourself in a pinch!
9+
10+
> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
11+
>
12+
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Chrome](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
13+
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Firefox](https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/)
14+
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Edge](https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj)
15+
16+
## Install and Import the Devtools
17+
18+
The devtools are a separate package that you need to install:
19+
20+
```bash
21+
npm i @tanstack/preact-query-devtools
22+
```
23+
24+
or
25+
26+
```bash
27+
pnpm add @tanstack/preact-query-devtools
28+
```
29+
30+
or
31+
32+
```bash
33+
yarn add @tanstack/preact-query-devtools
34+
```
35+
36+
or
37+
38+
```bash
39+
bun add @tanstack/preact-query-devtools
40+
```
41+
42+
You can import the devtools like this:
43+
44+
```tsx
45+
import { PreactQueryDevtools } from '@tanstack/preact-query-devtools'
46+
```
47+
48+
By default, Preact Query Devtools are only included in bundles when `process.env.NODE_ENV === 'development'`, so you don't need to worry about excluding them during a production build.
49+
50+
## Floating Mode
51+
52+
Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
53+
54+
Place the following code as high in your Preact app as you can. The closer it is to the root of the page, the better it will work!
55+
56+
```tsx
57+
import { PreactQueryDevtools } from '@tanstack/preact-query-devtools'
58+
59+
function App() {
60+
return (
61+
<QueryClientProvider client={queryClient}>
62+
{/* The rest of your application */}
63+
<PreactQueryDevtools initialIsOpen={false} />
64+
</QueryClientProvider>
65+
)
66+
}
67+
```
68+
69+
### Options
70+
71+
- `initialIsOpen: boolean`
72+
- Set this `true` if you want the dev tools to default to being open
73+
- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
74+
- Defaults to `bottom-right`
75+
- The position of the Preact Query logo to open and close the devtools panel
76+
- `position?: "top" | "bottom" | "left" | "right"`
77+
- Defaults to `bottom`
78+
- The position of the Preact Query devtools panel
79+
- `client?: QueryClient`,
80+
- Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
81+
- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
82+
- Use this to predefine some errors that can be triggered on your queries. Initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
83+
- `styleNonce?: string`
84+
- Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
85+
- `shadowDOMTarget?: ShadowRoot`
86+
- Default behavior will apply the devtool's styles to the head tag within the DOM.
87+
- Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instead of within the head tag in the light DOM.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: createAsyncStoragePersister
3+
title: createAsyncStoragePersister
4+
ref: docs/framework/react/plugins/createAsyncStoragePersister.md
5+
replace: { 'react-query': 'preact-query' }
6+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: createPersister
3+
title: experimental_createPersister
4+
ref: docs/framework/react/plugins/createPersister.md
5+
replace: { 'react-query': 'preact-query' }
6+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: createSyncStoragePersister
3+
title: createSyncStoragePersister
4+
ref: docs/framework/react/plugins/createSyncStoragePersister.md
5+
replace: { 'react-query': 'preact-query' }
6+
---
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
id: mutationOptions
3+
title: mutationOptions
4+
---
5+
6+
# Function: mutationOptions()
7+
8+
## Call Signature
9+
10+
```ts
11+
function mutationOptions<TData, TError, TVariables, TOnMutateResult>(options): WithRequired<CreateMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>
12+
```
13+
14+
Defined in: [packages/svelte-query/src/mutationOptions.ts](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/mutationOptions.ts)
15+
16+
### Type Parameters
17+
18+
#### TData
19+
20+
`TData` = `unknown`
21+
22+
#### TError
23+
24+
`TError` = `Error`
25+
26+
#### TVariables
27+
28+
`TVariables` = `void`
29+
30+
#### TOnMutateResult
31+
32+
`TOnMutateResult` = `unknown`
33+
34+
### Parameters
35+
36+
#### options
37+
38+
`WithRequired`\<[`CreateMutationOptions`](../type-aliases/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `'mutationKey'`\>
39+
40+
### Returns
41+
42+
`WithRequired`\<[`CreateMutationOptions`](../type-aliases/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `'mutationKey'`\>
43+
44+
## Call Signature
45+
46+
```ts
47+
function mutationOptions<TData, TError, TVariables, TOnMutateResult>(options): Omit<CreateMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>
48+
```
49+
50+
Defined in: [packages/svelte-query/src/mutationOptions.ts](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/mutationOptions.ts)
51+
52+
### Type Parameters
53+
54+
#### TData
55+
56+
`TData` = `unknown`
57+
58+
#### TError
59+
60+
`TError` = `Error`
61+
62+
#### TVariables
63+
64+
`TVariables` = `void`
65+
66+
#### TOnMutateResult
67+
68+
`TOnMutateResult` = `unknown`
69+
70+
### Parameters
71+
72+
#### options
73+
74+
`Omit`\<[`CreateMutationOptions`](../type-aliases/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `'mutationKey'`\>
75+
76+
### Returns
77+
78+
`Omit`\<[`CreateMutationOptions`](../type-aliases/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `'mutationKey'`\>

examples/angular/basic-persister/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"@angular/core": "^20.0.0",
1515
"@angular/platform-browser": "^20.0.0",
1616
"@tanstack/angular-query-experimental": "^5.90.25",
17-
"@tanstack/angular-query-persist-client": "^5.62.28",
18-
"@tanstack/query-async-storage-persister": "^5.90.23",
17+
"@tanstack/angular-query-persist-client": "^5.62.29",
18+
"@tanstack/query-async-storage-persister": "^5.90.24",
1919
"rxjs": "^7.8.2",
2020
"tslib": "^2.8.1",
2121
"zone.js": "0.15.0"

examples/preact/simple/src/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ const Example = () => {
4242
)
4343
}
4444

45-
render(<App />, document.getElementById('app'))
45+
const app = document.getElementById('app')
46+
if (!app) throw new Error('Missing #app element')
47+
48+
render(<App />, app)

examples/react/basic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"test:eslint": "eslint ./src"
1010
},
1111
"dependencies": {
12-
"@tanstack/query-async-storage-persister": "^5.90.23",
12+
"@tanstack/query-async-storage-persister": "^5.90.24",
1313
"@tanstack/react-query": "^5.90.21",
1414
"@tanstack/react-query-devtools": "^5.91.3",
15-
"@tanstack/react-query-persist-client": "^5.90.23",
15+
"@tanstack/react-query-persist-client": "^5.90.24",
1616
"react": "^19.0.0",
1717
"react-dom": "^19.0.0"
1818
},

examples/react/eslint-legacy/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"test:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint ./src/**/*.tsx"
1010
},
1111
"dependencies": {
12-
"@tanstack/query-async-storage-persister": "^5.90.23",
12+
"@tanstack/query-async-storage-persister": "^5.90.24",
1313
"@tanstack/react-query": "^5.90.21",
1414
"@tanstack/react-query-devtools": "^5.91.3",
15-
"@tanstack/react-query-persist-client": "^5.90.23",
15+
"@tanstack/react-query-persist-client": "^5.90.24",
1616
"react": "^19.0.0",
1717
"react-dom": "^19.0.0"
1818
},

0 commit comments

Comments
 (0)