Closed
Conversation
Coverage Report for CI Build 24257530993Coverage remained the same at 40.886%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
773fb37 to
953aaba
Compare
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^9.0.21→^11.0.0Release Notes
immerjs/immer (immer)
v11.1.4Compare Source
Bug Fixes
v11.1.3Compare Source
Bug Fixes
v11.1.2Compare Source
Bug Fixes
v11.1.0Compare Source
This feature release adds a new optional "array method overrides" plugin that significantly speeds up array methods when accessing drafts.
Changelog
Performance Improvements
As part of the recent performance optimization work, our benchmarks showed that all Proxy-based immutable update libraries were drastically slower than vanilla JS when calling both mutating and non-mutating array methods. After investigation, it turns out that an array method like
arr.filter()causes the Proxy'sgettrap to trigger for every single item in the array. This in turn forces creation of a new Proxy and internal Immer metadata for every item, even though this was just a read operation and no items were being updated.This release adds a new
enableArrayMethodsplugin that will override draft array methods to bypass the draft and directly operate on the underlying wrapped array instance. This significantly speeds up array operations.When enabled, the plugin overrides these array methods:
push,pop,shift,unshift,splice,reverse,sortfilter,slice,concat,flat,find,findIndex,findLast,findLastIndex,some,every,indexOf,lastIndexOf,includes,join,toString,toLocaleStringOur benchmarks show that the overridden methods (plus the other perf changes in Immer 10.2 and 11.0) are 50-80% faster than the baseline behavior of Immer 10.1.
The plugin adds about 1.5-2K minified to Immer's bundle size.
It's important to note that the plugin does change the "safe to mutate a draft" semantics of Immer. Any of these methods that receives an array item as a callback argument will not automatically wrap that item in a Proxy!. That means that if you try to mutate an argument in a method such as
filter, it will actually mutate the real underlying object, which will cause bugs in your app. This is an intentional design tradeoff. Semantically, all of these methods imply read-only access to array values, so if your code tries to mutate an array item in a callback, that is a bug in your code.Note that this does not override
map,flatMap,forEach, orreduce/reduceRight. Those methods do imply either side effects and potential mutations, or returning arbitrary values. Given that, we determined it was both safest and simplest to keep their behavior as-is.See the Array Methods Plugin docs page for further details on the behavior of the overridden methods.
What's Changed
v11.0.1Compare Source
Bug Fixes
v11.0.0Compare Source
Performance Improvements
BREAKING CHANGES
enable loose iteration by default
Simplify some iteration checks
Allow passing type to get/set utils to skip archetype lookup
Convert assigned_ to Map
Enable loose iteration
Replace recursive tree finalization with targeted callbacks
Ported Mutative's "finalization callback" approach as a more targeted and performant implementation for finalization compared to the existing recursive tree traversal approach:
inside of plain values
during tree traversal
v10.2.0Compare Source
Features
setUseStrictIteration(#1164) (e1996ce)v10.1.3Compare Source
Bug Fixes
v10.1.2Compare Source
Bug Fixes
v10.1.1Compare Source
Bug Fixes
applyPatchesto acceptreadonly Patch[](#1094) (4da2e0d)v10.1.0Compare Source
Features
setUseStrictShallowCopy("class_only")to revert to the old behavior. For more details see https://immerjs.github.io/immer/complex-objects#semantics-in-detailv10.0.4Compare Source
Bug Fixes
v10.0.3Compare Source
Bug Fixes
.mjsfile for react-native, which isn't supported by default. Fixes #1058 #1065 (#1075) (f6736a4)v10.0.2Compare Source
Bug Fixes
Objectishtype (#1043) (75e004d)v10.0.1Compare Source
Bug Fixes
v10.0.0Compare Source
Release notes
Proxy,Reflect,SymbolandMapandSet.createDraftandfinishDraft.enableES5(), you SHOULD NOT upgrade Immer.enableES5has been removed.produceis no longer exposed as thedefaultexport. This improves eco system compatibility, and makes sure that there is only one correct way of doing thingsenableAllPluginshas been removed, useenablePatches(); enableMapSet()insteadlengthproperty, in accordance with JSON spec. Thanks kshramt for implementing this in #964!Overall, there is a rough performance increase of 33% for Immer (and in some cases significantly higher), and the (non gzipped) bundle size has reduced from 16 to 11.5 KB, while the the minimal gzipped import of just
producehas remained roughly the same at 3.3 KB.For more details, see #1015
Migration steps
enableES5()call, don't migrateuseStrictShallowCopy(true)at startupimport produce from "immer"withimport {produce} from "immer"enableAllPlugins()withenablePatches(); enableMapSet();to be more specific and smoothen future migrations.createDraftinstead. Roughly:Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.