Skip to content

Commit a2fe8c0

Browse files
author
Žiga Ajdnik
committed
put enableES5() back to index.ts
1 parent 7985091 commit a2fe8c0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/toolkit/src/createReducer.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Draft } from 'immer'
2-
import createNextState, { isDraft, isDraftable, enableES5 } from 'immer'
2+
import createNextState, { isDraft, isDraftable } from 'immer'
33
import type { AnyAction, Action, Reducer } from 'redux'
44
import type { ActionReducerMapBuilder } from './mapBuilders'
55
import { executeReducerBuilderCallback } from './mapBuilders'
@@ -197,12 +197,6 @@ export function createReducer<S>(
197197
actionMatchers: ReadonlyActionMatcherDescriptionCollection<S> = [],
198198
defaultCaseReducer?: CaseReducer<S>
199199
): Reducer<S> {
200-
// We deliberately enable Immer's ES5 support, on the grounds that
201-
// we assume RTK will be used with React Native and other Proxy-less
202-
// environments. In addition, that's how Immer 4 behaved, and since
203-
// we want to ship this in an RTK minor, we should keep the same behavior.
204-
enableES5()
205-
206200
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] =
207201
typeof mapOrBuilderCallback === 'function'
208202
? executeReducerBuilderCallback(mapOrBuilderCallback)

packages/toolkit/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { enableES5 } from 'immer'
12
export * from 'redux'
23
export {
34
default as createNextState,
@@ -17,6 +18,12 @@ export type {
1718
export { createDraftSafeSelector } from './createDraftSafeSelector'
1819
export type { ThunkAction, ThunkDispatch } from 'redux-thunk'
1920

21+
// We deliberately enable Immer's ES5 support, on the grounds that
22+
// we assume RTK will be used with React Native and other Proxy-less
23+
// environments. In addition, that's how Immer 4 behaved, and since
24+
// we want to ship this in an RTK minor, we should keep the same behavior.
25+
enableES5();
26+
2027
export {
2128
// js
2229
configureStore,

0 commit comments

Comments
 (0)