Skip to content

Commit 4926c50

Browse files
committed
Merge branch 'feature/v1.6-integration' into docusaurus-upgrade
# Conflicts: # package-lock.json
2 parents 8835657 + 8af5b05 commit 4926c50

File tree

320 files changed

+249310
-9333
lines changed

Some content is hidden

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

320 files changed

+249310
-9333
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+
}

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ module.exports = {
1313
'@typescript-eslint/no-redeclare': 'off',
1414
'no-use-before-define': 'off',
1515
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
16+
'@typescript-eslint/consistent-type-imports': [
17+
'error',
18+
{ prefer: 'type-imports', disallowTypeAnnotations: false },
19+
],
1620
},
1721
overrides: [
1822
{
1923
files: ['src/tests/*.ts', 'src/**/tests/*.ts', 'src/**/tests/*.tsx'],
2024
rules: {
2125
'@typescript-eslint/no-unused-expressions': 'off',
2226
'no-lone-blocks': 'off',
27+
'no-sequences': 'off',
2328
},
2429
},
2530
],

.github/workflows/main.yaml

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

.github/workflows/size.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: size
2+
on: [pull_request]
3+
jobs:
4+
size:
5+
runs-on: ubuntu-latest
6+
env:
7+
CI_JOB_NUMBER: 1
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: andresz1/size-limit-action@v1
11+
with:
12+
github_token: ${{ secrets.GITHUB_TOKEN }}
13+
build_script: build-only

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ jobs:
2323
- name: Install deps
2424
run: npm ci
2525

26-
- name: Pack (including Prepare)
26+
- name: Build
27+
run: npm run build-ci
28+
29+
- name: Pack
2730
run: npm pack
28-
env:
29-
NODE_ENV: 'production' # this doesn't actually matter, so just set it to production
3031

3132
- uses: actions/upload-artifact@v2
3233
with:

.size-limit.js

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
const webpack = require('webpack')
2+
let { join } = require('path')
3+
4+
const suffixes = ['cjs.production.min.js', 'esm.js']
5+
6+
function withRtkPath(suffix) {
7+
return (config) => {
8+
config.plugins.push(
9+
new webpack.NormalModuleReplacementPlugin(
10+
/@reduxjs\/toolkit\/query\/react/,
11+
join(__dirname, `query/react`)
12+
),
13+
new webpack.NormalModuleReplacementPlugin(
14+
/@reduxjs\/toolkit\/query/,
15+
join(__dirname, `query`)
16+
),
17+
new webpack.NormalModuleReplacementPlugin(
18+
/@reduxjs\/toolkit/,
19+
join(__dirname)
20+
),
21+
new webpack.NormalModuleReplacementPlugin(
22+
/rtk-query-react.esm.js/,
23+
(r) => {
24+
const old = r.request
25+
r.request = r.request.replace(
26+
/rtk-query-react.esm.js$/,
27+
`rtk-query-react.${suffix}`
28+
)
29+
// console.log(old, '=>', r.request)
30+
}
31+
),
32+
new webpack.NormalModuleReplacementPlugin(/rtk-query.esm.js/, (r) => {
33+
const old = r.request
34+
r.request = r.request.replace(
35+
/rtk-query.esm.js$/,
36+
`rtk-query.${suffix}`
37+
)
38+
// console.log(old, '=>', r.request)
39+
}),
40+
new webpack.NormalModuleReplacementPlugin(
41+
/redux-toolkit.esm.js$/,
42+
(r) => {
43+
const old = r.request
44+
r.request = r.request.replace(
45+
/redux-toolkit.esm.js$/,
46+
`redux-toolkit.${suffix}`
47+
)
48+
// console.log(old, '=>', r.request)
49+
}
50+
)
51+
)
52+
if (suffix === 'cjs.production.min.js') {
53+
config.resolve.mainFields = ['main', 'module']
54+
}
55+
config.optimization.nodeEnv = 'production'
56+
return config
57+
}
58+
}
59+
60+
const ignoreAll = [
61+
'@reduxjs/toolkit',
62+
'@reduxjs/toolkit/query',
63+
'immer',
64+
'redux',
65+
'reselect',
66+
'redux-thunk',
67+
]
68+
69+
module.exports = [
70+
{
71+
name: `1. entry point: @reduxjs/toolkit`,
72+
path: 'dist/redux-toolkit.esm.js',
73+
},
74+
{
75+
name: `1. entry point: @reduxjs/toolkit/query`,
76+
path: 'dist/query/rtk-query.esm.js',
77+
},
78+
{
79+
name: `1. entry point: @reduxjs/toolkit/query/react`,
80+
path: 'dist/query/react/rtk-query-react.esm.js',
81+
},
82+
{
83+
name: `2. entry point: @reduxjs/toolkit (without dependencies)`,
84+
path: 'dist/redux-toolkit.esm.js',
85+
ignore: ignoreAll,
86+
},
87+
{
88+
name: `2. entry point: @reduxjs/toolkit/query (without dependencies)`,
89+
path: 'dist/query/rtk-query.esm.js',
90+
ignore: ignoreAll,
91+
},
92+
{
93+
name: `2. entry point: @reduxjs/toolkit/query/react (without dependencies)`,
94+
path: 'dist/query/react/rtk-query-react.esm.js',
95+
ignore: ignoreAll,
96+
},
97+
]
98+
.flatMap((e) =>
99+
suffixes.map((suffix) => ({
100+
...e,
101+
name: e.name + ` (${suffix})`,
102+
modifyWebpackConfig: withRtkPath(suffix),
103+
}))
104+
)
105+
.concat(
106+
...[
107+
{
108+
name: `3. createSlice`,
109+
import: { '@reduxjs/toolkit': '{ createSlice }' },
110+
},
111+
{
112+
name: `3. createEntityAdapter`,
113+
import: { '@reduxjs/toolkit': '{ createEntityAdapter }' },
114+
},
115+
{
116+
name: `3. configureStore`,
117+
import: { '@reduxjs/toolkit': '{ configureStore }' },
118+
},
119+
{
120+
name: `3. createApi`,
121+
import: { '@reduxjs/toolkit/query': '{ createApi }' },
122+
},
123+
{
124+
name: `3. createApi (react)`,
125+
import: { '@reduxjs/toolkit/query/react': '{ createApi }' },
126+
},
127+
{
128+
name: `3. fetchBaseQuery`,
129+
import: { '@reduxjs/toolkit/query': '{ fetchBaseQuery }' },
130+
},
131+
{
132+
name: `3. setupListeners`,
133+
import: { '@reduxjs/toolkit/query': '{ setupListeners }' },
134+
},
135+
{
136+
name: `3. ApiProvider`,
137+
import: { '@reduxjs/toolkit/query/react': '{ ApiProvider }' },
138+
},
139+
].map((e) => ({
140+
...e,
141+
name: e.name + ` (esm.js)`,
142+
modifyWebpackConfig: withRtkPath('esm.js'),
143+
}))
144+
)

docs/package-lock.json

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@types/redux-logger": "^3.0.8",
99
"axios": "^0.20.0",
1010
"formik": "^2.1.5",
11+
"graphql-request": "^3.4.0",
1112
"immutable": "^3.8.2",
1213
"rxjs": "^6.6.2"
1314
}

docs/rtk-query/api/ApiProvider.mdx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ Using this together with an existing Redux store will cause them to conflict wit
1717

1818
### Example
1919

20-
<iframe src="https://codesandbox.io/embed/rtk-query-apiprovider-iyzme?fontsize=12&hidenavigation=1&module=%2Fsrc%2FApp.tsx&theme=dark"
21-
style={{ width: '100%', height: '800px', border: 0, borderRadius: '4px', overflow: 'hidden' }}
22-
title="RTK Query ApiProvider"
23-
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
24-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
20+
<iframe
21+
src="https://codesandbox.io/embed/github/reduxjs/redux-toolkit/tree/feature/v1.6-integration/examples/query/react/with-apiprovider?fontsize=12&hidenavigation=1&module=%2Fsrc%2FApp.tsx&theme=dark"
22+
style={{
23+
width: '100%',
24+
height: '800px',
25+
border: 0,
26+
borderRadius: '4px',
27+
overflow: 'hidden',
28+
}}
29+
title="RTK Query ApiProvider"
30+
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
31+
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
2532
></iframe>

0 commit comments

Comments
 (0)