Skip to content

Commit

Permalink
Partially enable immutability check
Browse files Browse the repository at this point in the history
This is useful but makes things slower upon state changes. I think still
reasonable to have because:

1. It's only included in dev mode
2. The slowness in dev mode is not too noticeable (50~200ms on my machine)

The console warnings hint to disable it if the slowness becomes
unbearable.
  • Loading branch information
victorlin committed Oct 14, 2023
1 parent 0a2792d commit 2941948
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ const store = configureStore({
middleware: (getDefaultMiddleware) =>
// This adds the thunk middleware, and for development builds, other useful checks.
getDefaultMiddleware({
// TODO: Go through reducers and see why the state is not immutable nor serializable.
// These were not checked prior to the adoption of Redux Toolkit, and were not
// investigated to minimize conversion efforts.
immutableCheck: false,
immutableCheck: {
// Immutability can't be checked in the following due to circular references.
ignoredPaths: [
'tree.nodes',
'tree.vaccines',
'treeToo.nodes',
'treeToo.vaccines',
],
},

// By design, the state contains many values that are non-serializable.
// Instead of adding several ignoredPaths, disable this check entirely.
Expand Down

0 comments on commit 2941948

Please sign in to comment.