Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reduxjs/redux into gitatt…
Browse files Browse the repository at this point in the history
…ributes
  • Loading branch information
aryaemami59 committed Mar 21, 2024
2 parents c1b83a2 + a6984eb commit bda8a8a
Show file tree
Hide file tree
Showing 149 changed files with 10,926 additions and 9,142 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"sandboxes": ["vanilla", "vanilla-ts"],
"node": "16"
"node": "18"
}
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: false },
],
{ prefer: 'type-imports', disallowTypeAnnotations: false }
]
}
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 🤔 Questions and Help
url: https://redux.js.org/introduction/getting-started#help-and-discussion
about: This is a bug tracker, not a support system. For usage questions, please use our support resources.
- name: 🤔 Questions and Help
url: https://redux.js.org/introduction/getting-started#help-and-discussion
about: This is a bug tracker, not a support system. For usage questions, please use our support resources.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: preactjs/compressed-size-action@v2
Expand Down
72 changes: 46 additions & 26 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
Expand All @@ -29,14 +29,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.x']
node: ['20.x']

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Pack
run: yarn pack

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: package
path: ./package.tgz
Expand All @@ -65,21 +65,21 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['18.x']
node: ['20.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: .
Expand All @@ -102,14 +102,14 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['18.x']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
node: ['20.x']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4']
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand All @@ -120,7 +120,7 @@ jobs:
- name: Install TypeScript ${{ matrix.ts }}
run: yarn add typescript@${{ matrix.ts }}

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: .
Expand All @@ -143,19 +143,19 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['18.x']
node: ['20.x']
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: package
path: .

# Note: We currently expect "FalseCJS" failures for Node16 + `moduleResolution: "node16"
# Note: We currently expect "FalseESM" failures for Node16 + `moduleResolution: "node16"
- name: Run are-the-types-wrong
run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs
run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-esm

test-published-artifact:
name: Test Published Artifact ${{ matrix.example }}
Expand All @@ -165,29 +165,47 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['18.x']
example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm']
node: ['20.x']
example:
[
'cra4',
'cra5',
'next',
'vite',
'node-standard',
'node-esm',
'react-native',
'expo'
]
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Clone RTK repo
run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit

- name: Cache example deps
uses: actions/cache@v4
with:
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}/node_modules
key: test-published-artifact-${{ matrix.example }}-node_modules

- name: Check folder contents
run: ls -l .

- name: Install deps
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
run: yarn install

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
Expand All @@ -206,7 +224,9 @@ jobs:

- name: Build example
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
env:
NODE_OPTIONS: --openssl-legacy-provider
run: yarn build

- name: Run test step
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
Expand Down
873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <a href='https://redux.js.org'><img src='https://avatars.githubusercontent.com/u/13142323?s=200&v=4' height='60' alt='Redux Logo' aria-label='redux.js.org' style="display: flex;align-items: center;"/>Redux</a>
# <a href='https://redux.js.org'><img src='https://avatars.githubusercontent.com/u/13142323?s=200&v=4' height='60' alt='Redux Logo' aria-label='redux.js.org' style="display: flex;align-items: center;"/>Redux</a>

Redux is a predictable state container for JavaScript apps.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/combineReducers.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default combineReducers({
#### `App.js`

```js
import { configureStore } from '@reduxjs/toolkit'
import { configureStore } from '@reduxjs/toolkit'
import reducer from './reducers/index'

const store = configureStore({
Expand Down
2 changes: 0 additions & 2 deletions docs/introduction/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ Here are some suggestions on when it makes sense to use Redux:
>
> - **[Redux FAQ: When should I use Redux?](../faq/General.md#when-should-i-use-redux)**
> - **[You Might Not Need Redux](https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367)**
>
> - **[The Tao of Redux, Part 1 - Implementation and Intent](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/)**
>
> - **[The Tao of Redux, Part 2 - Practice and Philosophy](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/)**
> - **[Redux FAQ](../FAQ.md)**
4 changes: 2 additions & 2 deletions docs/usage/WritingTests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {

export function renderWithProviders(
ui: React.ReactElement,
extendedRenderOptions: ExtendedRenderOptions = {},
extendedRenderOptions: ExtendedRenderOptions = {}
) {
const {
preloadedState = {},
Expand All @@ -367,7 +367,7 @@ export function renderWithProviders(
// Return an object with the store and all of RTL's query functions
return {
store,
...render(ui, { wrapper: Wrapper, ...renderOptions }),
...render(ui, { wrapper: Wrapper, ...renderOptions })
}
}
```
Expand Down
6 changes: 6 additions & 0 deletions docs/usage/deriving-data-selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ const selectItemsByCategory = createSelector(
)
```

You can then use the selector like this:

```js
const electronicItems = selectItemsByCategory(state, "electronics");
```

For consistency, you may want to consider passing additional parameters to a selector as a single object, such as `selectThings(state, otherArgs)`, and then extracting values from the `otherArgs` object.

#### Selector Factories
Expand Down
23 changes: 13 additions & 10 deletions docs/usage/migrating-to-modern-redux.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ This example shows several possible common tasks when setting up a Redux store:
None of these are _required_, but they do show up frequently in real-world codebases.

```js title="Custom Store Setup: src/app/store.js"
import { configureStore, combineReducers} from '@reduxjs/toolkit'
import { configureStore, combineReducers } from '@reduxjs/toolkit'
import {
persistStore,
persistReducer,
Expand All @@ -139,7 +139,7 @@ import {
PAUSE,
PERSIST,
PURGE,
REGISTER,
REGISTER
} from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { PersistGate } from 'redux-persist/integration/react'
Expand All @@ -163,7 +163,7 @@ const rootReducer = combineReducers({
const persistConfig = {
key: 'root',
version: 1,
storage,
storage
}

const persistedReducer = persistReducer(persistConfig, rootReducer)
Expand All @@ -175,12 +175,12 @@ const store = configureStore({
const middleware = getDefaultMiddleware({
// Pass in a custom `extra` argument to the thunk middleware
thunk: {
extraArgument: {serviceLayer}
extraArgument: { serviceLayer }
},
// Customize the built-in serializability dev check
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
}
}).concat(customMiddleware, api.middleware)

// Conditionally add another middleware in dev
Expand All @@ -191,9 +191,12 @@ const store = configureStore({
return middleware
},
// Turn off devtools in prod, or pass options in dev
devTools: process.env.NODE_ENV === 'production' ? false : {
stateSanitizer: stateSanitizerForDevtools
}
devTools:
process.env.NODE_ENV === 'production'
? false
: {
stateSanitizer: stateSanitizerForDevtools
}
})
```

Expand Down Expand Up @@ -817,7 +820,7 @@ export const store = createStore(rootReducer)
export type RootAction = TodoActions | CounterActions
// ❌ Common pattern: manually defining the root state type with each field
export interface RootState {
todos: TodosState;
todos: TodosState
counter: CounterState
}
Expand Down

0 comments on commit bda8a8a

Please sign in to comment.