Skip to content

Commit 7a2bc3c

Browse files
authored
docs(examples/preact/optimistic-updates): add optimistic-updates example (#12404)
1 parent 8af7af6 commit 7a2bc3c

20 files changed

Lines changed: 937 additions & 0 deletions

‎docs/config.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7027,6 +7027,10 @@
70277027
"label": "Auto Refetching / Polling / Realtime",
70287028
"to": "framework/preact/examples/auto-refetching"
70297029
},
7030+
{
7031+
"label": "Optimistic Updates",
7032+
"to": "framework/preact/examples/optimistic-updates"
7033+
},
70307034
{
70317035
"label": "Pagination",
70327036
"to": "framework/preact/examples/pagination"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
pnpm-lock.yaml
15+
yarn.lock
16+
package-lock.json
17+
18+
# misc
19+
.DS_Store
20+
.env.local
21+
.env.development.local
22+
.env.test.local
23+
.env.production.local
24+
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Example
2+
3+
To run this example:
4+
5+
- `npm install`
6+
- `npm run dev`
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
import { tanstackConfig } from '@tanstack/eslint-config'
4+
import pluginQuery from '@tanstack/eslint-plugin-query'
5+
// @ts-ignore: no types for eslint-config-preact
6+
import preact from 'eslint-config-preact'
7+
import { defineConfig } from 'eslint/config'
8+
9+
export default defineConfig([
10+
...preact,
11+
...tanstackConfig,
12+
...pluginQuery.configs['flat/recommended-strict'],
13+
{
14+
rules: {
15+
'no-duplicate-imports': 'off',
16+
'no-redeclare': 'off',
17+
'no-unused-vars': 'off',
18+
},
19+
},
20+
])
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" type="image/svg+xml" href="/emblem-light.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
9+
<title>TanStack Query Preact Optimistic Updates Example App</title>
10+
</head>
11+
<body>
12+
<noscript>You need to enable JavaScript to run this app.</noscript>
13+
<div id="root"></div>
14+
<script type="module" src="/src/index.tsx"></script>
15+
</body>
16+
</html>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@tanstack/query-example-preact-optimistic-updates",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview",
9+
"test:eslint": "eslint ./src",
10+
"test:types": "tsc --noEmit"
11+
},
12+
"dependencies": {
13+
"@tanstack/preact-query": "^5.105.0",
14+
"@tanstack/preact-query-devtools": "^5.105.0",
15+
"msw": "^2.15.0",
16+
"preact": "^11.0.1"
17+
},
18+
"devDependencies": {
19+
"@preact/preset-vite": "^2.10.6",
20+
"@tanstack/eslint-plugin-query": "^5.105.0",
21+
"eslint": "^9.36.0",
22+
"eslint-config-preact": "^2.0.0",
23+
"typescript": "^5.9.3",
24+
"vite": "^8.3.1"
25+
},
26+
"msw": {
27+
"workerDirectory": [
28+
"public"
29+
]
30+
}
31+
}
Lines changed: 13 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)