Skip to content
Myr

freezing.md

This file

Path

docs/freezing.md

19 lines · 1.4 KiB · Markdown

Last changed by

Added egghead.io video embedsMichel Weststratebefore adoptiona866760

History of this file

Take it

Merge pull request #421 from immerjs/docsMichel Weststratebefore adoption9be6e46

lines 1–5why, one step back
1---
2id: freezing3title: Auto freezing4---5

Added egghead.io video embedsMichel Weststratebefore adoptiona866760

lines 6–16why, one step back
6<div id="codefund"><!-- fallback content --></div>
78<details>9 <summary style="color: white; background:#c200c2;padding:5px;margin:5px;border-radius:2px">egghead.io lesson 7: Immer automatically freezes data</summary>10 <br>11 <div style="padding:5px;">12 <iframe style="border: none;" width=760 height=427 src="https://egghead.io/lessons/javascript-produces-immutable-data-and-avoid-unnecessary-creation-of-new-data-trees-with-immer/embed" ></iframe>13 </div>14 <a style="font-style:italic;padding:5px;margin:5px;" href="https://egghead.io/lessons/javascript-produces-immutable-data-and-avoid-unnecessary-creation-of-new-data-trees-with-immer">Hosted on egghead.io</a>15</details>16

Merge pull request #422 from xkxx/patch-1Michel Weststratebefore adoptionf37b6be

line 17why, one step back
17Immer automatically freezes any state trees that are modified using `produce`. This protects against accidental modifications of the state tree outside of a producer. This comes with a performance impact, so it is recommended to disable this option in production. By default, it is turned on during local development and turned off in production. Use `setAutoFreeze(true / false)` to explicitly turn this feature on or off.

Merge pull request #421 from immerjs/docsMichel Weststratebefore adoption9be6e46

lines 18–19why, one step back
18
19_⚠️ If auto freezing is enabled, recipes are not entirely side-effect free: Any plain object or array that ends up in the produced result, will be frozen, even when these objects were not frozen before the start of the producer! ⚠️_