Skip to content

Commit

Permalink
Merge pull request #2859 from reduxjs/feature/final-v1.9-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson authored Nov 4, 2022
2 parents 48fe9e1 + 5e4ad31 commit ed75be0
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
fail-fast: false
matrix:
node: ['16.x']
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8']
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9.2-rc']
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down
10 changes: 5 additions & 5 deletions docs/api/autoBatchEnhancer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hide_title: true

# `autoBatchEnhancer`

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.
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.

## Basic Usage

Expand Down Expand Up @@ -83,12 +83,12 @@ Any action that is tagged with `action.meta[SHOULD_AUTOBATCH] = true` will be tr
`autoBatchEnhancer` accepts options to configure how the notification callback is queued:
- `{type: 'tick'}: queues using `queueMicrotask` (default)
- `{type: 'raf'}`: queues using `requestAnimationFrame` (default)
- `{type: 'tick'}: queues using `queueMicrotask`
- `{type: 'timer, timeout: number}`: queues using `setTimeout`
- `{type: 'raf'}`: queues using `requestAnimationFrame`
- `{type: 'callback', queueNotification: (notify: () => void) => void}: lets you provide your own callback
- `{type: 'callback', queueNotification: (notify: () => void) => void}: lets you provide your own callback, such as a debounced or throttled function
The default behavior is to queue the notifications at the end of the current event loop using `queueMicrotask`.
The default behavior is to queue the notifications using `requestAnimationFrame`.
The `SHOULD_AUTOBATCH` value is meant to be opaque - it's currently a string for simplicity, but could be a `Symbol` in the future.
Expand Down
8 changes: 4 additions & 4 deletions packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
"query"
],
"dependencies": {
"immer": "^9.0.7",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"reselect": "^4.1.5"
"immer": "^9.0.16",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"reselect": "^4.1.7"
},
"peerDependencies": {
"react": "^16.9.0 || ^17.0.0 || ^18",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/autoBatchEnhancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const createQueueWithTimer = (timeout: number) => {
*
*/
export const autoBatchEnhancer =
(options: AutoBatchOptions = { type: 'tick' }): StoreEnhancer =>
(options: AutoBatchOptions = { type: 'raf' }): StoreEnhancer =>
(next) =>
(...args) => {
const store = next(...args)
Expand Down
40 changes: 36 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6401,7 +6401,7 @@ __metadata:
eslint-plugin-react: ^7.23.2
eslint-plugin-react-hooks: ^4.2.0
fs-extra: ^9.1.0
immer: ^9.0.7
immer: ^9.0.16
invariant: ^2.2.4
jest: ^27
json-stringify-safe: ^5.0.1
Expand All @@ -6411,9 +6411,9 @@ __metadata:
node-fetch: ^2.6.1
prettier: ^2.2.1
query-string: ^7.0.1
redux: ^4.1.2
redux-thunk: ^2.4.1
reselect: ^4.1.5
redux: ^4.2.0
redux-thunk: ^2.4.2
reselect: ^4.1.7
rimraf: ^3.0.2
rollup: ^2.47.0
rollup-plugin-strip-code: ^0.2.6
Expand Down Expand Up @@ -16212,6 +16212,13 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"immer@npm:^9.0.16":
version: 9.0.16
resolution: "immer@npm:9.0.16"
checksum: e9a5ca65c929b329da7a3b7beccf7984271cda7bdd47b2cab619eac3277dcd56598c211b55cc340786b6eff0c06652ac018808d9fd744443f06882364dece6bc
languageName: node
linkType: hard

"immer@npm:^9.0.7":
version: 9.0.7
resolution: "immer@npm:9.0.7"
Expand Down Expand Up @@ -23474,6 +23481,15 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"redux-thunk@npm:^2.4.2":
version: 2.4.2
resolution: "redux-thunk@npm:2.4.2"
peerDependencies:
redux: ^4
checksum: c7f757f6c383b8ec26152c113e20087818d18ed3edf438aaad43539e9a6b77b427ade755c9595c4a163b6ad3063adf3497e5fe6a36c68884eb1f1cfb6f049a5c
languageName: node
linkType: hard

"redux@npm:^4.0.0, redux@npm:^4.1.2":
version: 4.1.2
resolution: "redux@npm:4.1.2"
Expand All @@ -23483,6 +23499,15 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"redux@npm:^4.2.0":
version: 4.2.0
resolution: "redux@npm:4.2.0"
dependencies:
"@babel/runtime": ^7.9.2
checksum: 75f3955c89b3f18edf5411e5fb482aa2e4f41a416183e8802a6bf6472c4fc3d47675b8b321d147f8af8e0f616436ac507bf5a25f1c4d6180e797b549c7db2c1d
languageName: node
linkType: hard

"reftools@npm:^1.1.9":
version: 1.1.9
resolution: "reftools@npm:1.1.9"
Expand Down Expand Up @@ -23909,6 +23934,13 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"reselect@npm:^4.1.7":
version: 4.1.7
resolution: "reselect@npm:4.1.7"
checksum: 738d8e2b8f0dca154ad29de6a209c9fbca2d70ae6788fd85df87f2c74b95a65bbf2d16d43a9e2faff39de34d17a29d706ba08a6b2ee5660c09589edbd19af7e1
languageName: node
linkType: hard

"resolve-alpn@npm:^1.0.0":
version: 1.2.1
resolution: "resolve-alpn@npm:1.2.1"
Expand Down

0 comments on commit ed75be0

Please sign in to comment.