Skip to content

Commit ed75be0

Browse files
authored
Merge pull request #2859 from reduxjs/feature/final-v1.9-tweaks
2 parents 48fe9e1 + 5e4ad31 commit ed75be0

File tree

5 files changed

+47
-15
lines changed

5 files changed

+47
-15
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
fail-fast: false
9797
matrix:
9898
node: ['16.x']
99-
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8']
99+
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9.2-rc']
100100
steps:
101101
- name: Checkout repo
102102
uses: actions/checkout@v2

docs/api/autoBatchEnhancer.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ hide_title: true
99

1010
# `autoBatchEnhancer`
1111

12-
A Redux store enhancer that looks for one or more "low-priority" dispatched actions in a row, and delays notifying subscribers until either the end of the current event loop tick or when the next "normal-priority" action is dispatched.
12+
A Redux store enhancer that looks for one or more "low-priority" dispatched actions in a row, and queues a callback to run subscriber notifications on a delay. It then notifies subscribers either when the queued callback runs, or when the next "normal-priority" action is dispatched, whichever is first.
1313

1414
## Basic Usage
1515

@@ -83,12 +83,12 @@ Any action that is tagged with `action.meta[SHOULD_AUTOBATCH] = true` will be tr
8383
8484
`autoBatchEnhancer` accepts options to configure how the notification callback is queued:
8585
86-
- `{type: 'tick'}: queues using `queueMicrotask` (default)
86+
- `{type: 'raf'}`: queues using `requestAnimationFrame` (default)
87+
- `{type: 'tick'}: queues using `queueMicrotask`
8788
- `{type: 'timer, timeout: number}`: queues using `setTimeout`
88-
- `{type: 'raf'}`: queues using `requestAnimationFrame`
89-
- `{type: 'callback', queueNotification: (notify: () => void) => void}: lets you provide your own callback
89+
- `{type: 'callback', queueNotification: (notify: () => void) => void}: lets you provide your own callback, such as a debounced or throttled function
9090
91-
The default behavior is to queue the notifications at the end of the current event loop using `queueMicrotask`.
91+
The default behavior is to queue the notifications using `requestAnimationFrame`.
9292
9393
The `SHOULD_AUTOBATCH` value is meant to be opaque - it's currently a string for simplicity, but could be a `Symbol` in the future.
9494

packages/toolkit/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@
9797
"query"
9898
],
9999
"dependencies": {
100-
"immer": "^9.0.7",
101-
"redux": "^4.1.2",
102-
"redux-thunk": "^2.4.1",
103-
"reselect": "^4.1.5"
100+
"immer": "^9.0.16",
101+
"redux": "^4.2.0",
102+
"redux-thunk": "^2.4.2",
103+
"reselect": "^4.1.7"
104104
},
105105
"peerDependencies": {
106106
"react": "^16.9.0 || ^17.0.0 || ^18",

packages/toolkit/src/autoBatchEnhancer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const createQueueWithTimer = (timeout: number) => {
5858
*
5959
*/
6060
export const autoBatchEnhancer =
61-
(options: AutoBatchOptions = { type: 'tick' }): StoreEnhancer =>
61+
(options: AutoBatchOptions = { type: 'raf' }): StoreEnhancer =>
6262
(next) =>
6363
(...args) => {
6464
const store = next(...args)

yarn.lock

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6401,7 +6401,7 @@ __metadata:
64016401
eslint-plugin-react: ^7.23.2
64026402
eslint-plugin-react-hooks: ^4.2.0
64036403
fs-extra: ^9.1.0
6404-
immer: ^9.0.7
6404+
immer: ^9.0.16
64056405
invariant: ^2.2.4
64066406
jest: ^27
64076407
json-stringify-safe: ^5.0.1
@@ -6411,9 +6411,9 @@ __metadata:
64116411
node-fetch: ^2.6.1
64126412
prettier: ^2.2.1
64136413
query-string: ^7.0.1
6414-
redux: ^4.1.2
6415-
redux-thunk: ^2.4.1
6416-
reselect: ^4.1.5
6414+
redux: ^4.2.0
6415+
redux-thunk: ^2.4.2
6416+
reselect: ^4.1.7
64176417
rimraf: ^3.0.2
64186418
rollup: ^2.47.0
64196419
rollup-plugin-strip-code: ^0.2.6
@@ -16212,6 +16212,13 @@ fsevents@^1.2.7:
1621216212
languageName: node
1621316213
linkType: hard
1621416214

16215+
"immer@npm:^9.0.16":
16216+
version: 9.0.16
16217+
resolution: "immer@npm:9.0.16"
16218+
checksum: e9a5ca65c929b329da7a3b7beccf7984271cda7bdd47b2cab619eac3277dcd56598c211b55cc340786b6eff0c06652ac018808d9fd744443f06882364dece6bc
16219+
languageName: node
16220+
linkType: hard
16221+
1621516222
"immer@npm:^9.0.7":
1621616223
version: 9.0.7
1621716224
resolution: "immer@npm:9.0.7"
@@ -23474,6 +23481,15 @@ fsevents@^1.2.7:
2347423481
languageName: node
2347523482
linkType: hard
2347623483

23484+
"redux-thunk@npm:^2.4.2":
23485+
version: 2.4.2
23486+
resolution: "redux-thunk@npm:2.4.2"
23487+
peerDependencies:
23488+
redux: ^4
23489+
checksum: c7f757f6c383b8ec26152c113e20087818d18ed3edf438aaad43539e9a6b77b427ade755c9595c4a163b6ad3063adf3497e5fe6a36c68884eb1f1cfb6f049a5c
23490+
languageName: node
23491+
linkType: hard
23492+
2347723493
"redux@npm:^4.0.0, redux@npm:^4.1.2":
2347823494
version: 4.1.2
2347923495
resolution: "redux@npm:4.1.2"
@@ -23483,6 +23499,15 @@ fsevents@^1.2.7:
2348323499
languageName: node
2348423500
linkType: hard
2348523501

23502+
"redux@npm:^4.2.0":
23503+
version: 4.2.0
23504+
resolution: "redux@npm:4.2.0"
23505+
dependencies:
23506+
"@babel/runtime": ^7.9.2
23507+
checksum: 75f3955c89b3f18edf5411e5fb482aa2e4f41a416183e8802a6bf6472c4fc3d47675b8b321d147f8af8e0f616436ac507bf5a25f1c4d6180e797b549c7db2c1d
23508+
languageName: node
23509+
linkType: hard
23510+
2348623511
"reftools@npm:^1.1.9":
2348723512
version: 1.1.9
2348823513
resolution: "reftools@npm:1.1.9"
@@ -23909,6 +23934,13 @@ fsevents@^1.2.7:
2390923934
languageName: node
2391023935
linkType: hard
2391123936

23937+
"reselect@npm:^4.1.7":
23938+
version: 4.1.7
23939+
resolution: "reselect@npm:4.1.7"
23940+
checksum: 738d8e2b8f0dca154ad29de6a209c9fbca2d70ae6788fd85df87f2c74b95a65bbf2d16d43a9e2faff39de34d17a29d706ba08a6b2ee5660c09589edbd19af7e1
23941+
languageName: node
23942+
linkType: hard
23943+
2391223944
"resolve-alpn@npm:^1.0.0":
2391323945
version: 1.2.1
2391423946
resolution: "resolve-alpn@npm:1.2.1"

0 commit comments

Comments
 (0)