-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImmutableStateInvariantMiddleware affecting tests in dev environment (#23) #219
Conversation
to resolve the ESLint no-unused-vars error
src/app/state/store.tsx
Outdated
const newMiddleware = getDefaultMiddleware(defaultMiddlewareOptions).concat(middleware); | ||
const newMiddleware = getDefaultMiddleware({ | ||
immutableCheck: false, | ||
serializableCheck: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this one be false also? I thought we were only concerned about the immutability check as that's the one being noisy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right! I will make changes to this on Monday morning!
src/app/state/store.tsx
Outdated
return newMiddleware; | ||
}, | ||
preloadedState: {}, | ||
devTools: process.env.NODE_ENV !== "production", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not need these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so because it should keep the preloadedState and devTools configurations as they are important for initialising the Redux store with a predefined state and enabling Redux DevTools during development.
- middleware: Disables only the immutableCheck while keeping the serializableCheck enabled.
- preloadedState: Initialises the store with an empty state object - it can be customised if needed.
- devTools: Enables Redux DevTools only in the development environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok but you've removed them is what I mean ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert facepalm emoji - that was very unintentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rectified it now!
Quality Gate passedIssues Measures |
Ticket: https://github.com/isaaccomputerscience/isaac-cs-issues/issues/23
Sometimes when running tests in React app a console warning will appear:
"ImmutableStateInvariantMiddleware took 106ms, which is more than the warning threshold of 32ms.
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode."