Skip to content

Only run serializableCheck on actions and not on state #885

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

Closed
ksjogo opened this issue Feb 3, 2021 · 3 comments · Fixed by #943
Closed

Only run serializableCheck on actions and not on state #885

ksjogo opened this issue Feb 3, 2021 · 3 comments · Fixed by #943
Milestone

Comments

@ksjogo
Copy link

ksjogo commented Feb 3, 2021

The serializableCheck is quite valuable, but with our state architecture it often takes up to 100ms for every action of which a lot might be dispatched.
It would be great to have an option to only run the check on the current action and not the whole state.
This seems to be quite easy to add around

const state = storeAPI.getState()

Could I create a PR?

@markerikson
Copy link
Collaborator

Yeah, that seems reasonable. Please go ahead.

@phryneas
Copy link
Member

phryneas commented Feb 3, 2021

While you're at it: it might also be interesting to skip out of the check if the part of the state is frozen. That will usually be the case with data that was autofrozen by immer, so most of the time the check would be pretty obsolete anyways.

@markerikson
Copy link
Collaborator

Yeah, would it be worth having the mutation check middleware look for frozen state as well?

I could see that speeding up both of these middleware noticeably, which would actually improve the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants