Skip to content

Commit 7faa7b4

Browse files
committedNov 19, 2020
docs: some refinements on freezing
1 parent 51cc8b8 commit 7faa7b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎docs/performance.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Most important observation:
4444

4545
### Pre-freeze data
4646

47-
When adding a large data set to the state tree in an Immer producer (for example data received from a JSON endpoint), it is worth to call `freeze(json)` on the root of the data to be added first. This will allow Immer to add the new data to the tree faster, as it will skip _recursively_ freezing it, or searching the new data for any changes (drafts) that might be made.
47+
When adding a large data set to the state tree in an Immer producer (for example data received from a JSON endpoint), it is worth to call `freeze(json)` on the root of the data that is being added first. To _shallowly_ freeze it. This will allow Immer to add the new data to the tree faster, as it will avoid the need to _recursively_ scan and freeze the new data.
4848

4949
### You can always opt-out
5050

‎src/core/immerClass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class Immer implements ProducersFns {
164164
/**
165165
* Pass true to automatically freeze all copies created by Immer.
166166
*
167-
* By default, auto-freezing is disabled in production.
167+
* By default, auto-freezing is enabled.
168168
*/
169169
setAutoFreeze(value: boolean) {
170170
this.autoFreeze_ = value

0 commit comments

Comments
 (0)
Please sign in to comment.