freezing.md
This file
Path
docs/freezing.md
25 lines · 1.7 KiB · Markdown
Last changed by
feature: Always freeze by default (#702)Michel Weststratebefore adoptiona406c8f
History of this fileTake it
Merge pull request #421 from immerjs/docsMichel Weststratebefore adoption9be6e46
lines 1–5why, one step back1---2id: freezing3title: Auto freezing4---5docs: updated sponsor linksMichel Weststratebefore adoptionf97d037
lines 6–8why, one step back6<center>7<div data-ea-publisher="immerjs" data-ea-type="image" class="horizontal bordered"></div>8</center>Added egghead.io video embedsMichel Weststratebefore adoptiona866760
lines 9–13why, one step back910<details>11 <summary style="color: white; background:#c200c2;padding:5px;margin:5px;border-radius:2px">egghead.io lesson 7: Immer automatically freezes data</summary>12 <br>13 <div style="padding:5px;">docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585
line 14why, one step back14 <iframe style="border: none;" width=760 height=427 scrolling="no" src="https://egghead.io/lessons/javascript-produces-immutable-data-and-avoid-unnecessary-creation-of-new-data-trees-with-immer/embed" ></iframe>Added egghead.io video embedsMichel Weststratebefore adoptiona866760
lines 15–18why, one step back15 </div>16 <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>17</details>18feature: Always freeze by default (#702)Michel Weststratebefore adoptiona406c8f
line 19why, one step back19Immer automatically freezes any state trees that are modified using `produce`. This protects against accidental modifications of the state tree outside of a producer. In most cases this provides the most optimal behavior, but `setAutoFreeze(true / false)` can be used to explicitly turn this feature on or off.Merge pull request #421 from immerjs/docsMichel Weststratebefore adoption9be6e46
line 20why, one step back20Immer 7Michel Weststratebefore adoption467ea5d
line 21why, one step back21Immer will never freeze (the contents of) non-enumerable, non-own or symbolic properties, unless their content was drafted.feature: Always freeze by default (#702)Michel Weststratebefore adoptiona406c8f
lines 22–23why, one step back2223_⚠️ Immer freezes everything recursively, for large data objects that won't be changed in the future this might be over-kill, in that case it can be more efficient to shallowly pre-freeze data using the `freeze` utility.⚠️_Immer 7Michel Weststratebefore adoption467ea5d
line 24why, one step back24Merge pull request #421 from immerjs/docsMichel Weststratebefore adoption9be6e46
line 25why, one step back25_⚠️ 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! ⚠️_