-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Idea: always freeze + freeze
export
#687
Comments
@mweststrate if you are to make this change can I please ask that you maintain the ability to override this setting manually still - both globally or via the Would someone be able to point me in the direction of docs/discussions around the reasoning and behaviour of the deep pruning? x |
@ctrlplusb yes, it will still be possible to use
|
I appreciate the insight 💜 |
BREAKING CHANGE: always freeze by default, even in production mode. Use `setAutoFreeze(process.env.NODE_ENV !== 'production')` for the old behavior. See #687 (comment) for the rationale. Fixes #649, #681, #687
Released in 8.0.0 |
🚀 Feature Proposal
Currently autoFreeze is disabled by default in production builds, with the assumption that that is faster. However, since the deep pruning for drafts introduced in Immer 7, that is no longer the case; frozen data allows for an early bail out, where non frozen data doesnt. So although initial storage is slower with autofreeze, subsequent updates are faster.
By enabling auttoFreeze in all environments by default we fix a few problems:
As optimisation tip it should be made clear that shallowly pre-freezing data about to be stored can bail out of expensive deep freezing without loosing the benefits of the non-deep pruning. Maybe even export a specific
preFreeze
method for this reason, or reuse the existingfreeze
export.The text was updated successfully, but these errors were encountered: