Skip to content

Commit 7d200c2

Browse files
Khartirmsutkowskiphryneas
authored
Docs/Examples - add optimistic-update example to repo (#1095)
Co-authored-by: Matt Sutkowski <msutkowski@gmail.com> Co-authored-by: Lenz Weber <mail@lenzw.de>
1 parent 6c197df commit 7d200c2

File tree

21 files changed

+18134
-8286
lines changed

21 files changed

+18134
-8286
lines changed

.codesandbox/ci.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"sandboxes": [
33
"vanilla",
44
"vanilla-ts",
5-
"github/reduxjs/rtk-github-issues-example"
5+
"github/reduxjs/rtk-github-issues-example",
6+
"github/reduxjs/toolkit/examples/query/react/optimistic-updates"
67
],
78
"node": "14"
8-
}
9+
}

docs/rtk-query/usage/examples.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ In the example below you'll notice a few things. There are two `Posts` list on t
3232
The example has some intentionally wonky behavior... when editing the name of a post, there is a decent chance you'll get a random error.
3333
:::
3434

35-
<iframe src="https://codesandbox.io/embed/concepts-optimistic-updates-lush8?fontsize=12&hidenavigation=1&module=%2Fsrc%2Fapp%2Fservices%2Fposts.ts&theme=dark&runonclick=1"
35+
<iframe src="https://codesandbox.io/embed/github/reduxjs/redux-toolkit/tree/feature/v1.6-integration/examples/query/react/optimistic-update?fontsize=12&hidenavigation=1&module=%2Fsrc%2Fapp%2Fservices%2Fposts.ts&theme=dark&runonclick=1"
3636
style={{ width: '100%', height: '800px', border: 0, borderRadius: '4px', overflow: 'hidden' }}
3737
title="RTK Query Optimistic Update Example"
3838
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"

example/index.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/package-lock.json

Lines changed: 0 additions & 8256 deletions
This file was deleted.

example/package.json

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

examples/query/react/optimistic-update/package-lock.json

Lines changed: 17182 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "concepts-optimistic-updates",
3+
"version": "1.0.0",
4+
"description": "",
5+
"keywords": [],
6+
"main": "./src/index.tsx",
7+
"dependencies": {
8+
"@chakra-ui/react": "1.0.0",
9+
"@emotion/react": "^11.4.0",
10+
"@emotion/styled": "^11.3.0",
11+
"@mswjs/data": "^0.3.0",
12+
"@reduxjs/toolkit": "^1.6.0-beta.0",
13+
"framer-motion": "^2.9.5",
14+
"msw": "0.28.2",
15+
"react": "17.0.2",
16+
"react-dom": "17.0.2",
17+
"react-icons": "3.11.0",
18+
"react-redux": "^7.2.4",
19+
"react-router-dom": "5.2.0",
20+
"react-scripts": "4.0.2",
21+
"uuid": "^8.3.2"
22+
},
23+
"devDependencies": {
24+
"@types/react": "17.0.0",
25+
"@types/react-dom": "17.0.0",
26+
"@types/react-redux": "7.1.9",
27+
"@types/react-router-dom": "5.1.6",
28+
"typescript": "4.1.3",
29+
"whatwg-fetch": "^3.4.1"
30+
},
31+
"resolutions": {
32+
"@typescript-eslint/parser": "4.4.1"
33+
},
34+
"scripts": {
35+
"start": "react-scripts start",
36+
"build": "react-scripts build",
37+
"prebuild": "rm -rf dist/"
38+
},
39+
"eslintConfig": {
40+
"extends": [
41+
"react-app"
42+
]
43+
},
44+
"browserslist": [
45+
">0.2%",
46+
"not dead",
47+
"not ie <= 11",
48+
"not op_mini all"
49+
],
50+
"msw": {
51+
"workerDirectory": "public"
52+
}
53+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>
44+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"short_name": "RTK Query Demo",
3+
"name": "RTK Query Demo",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"theme_color": "#000000",
7+
"background_color": "#ffffff"
8+
}

0 commit comments

Comments
 (0)