-
-
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
Immer 10 #1028
Immer 10 #1028
Conversation
Patches generated by the current implementation do not follow the RFC method for removing an element from an array (https://www.rfc-editor.org/rfc/rfc6902#page-13) and cannot be used from other languages (e.g., https://pypi.org/project/jsonpatch/).
…to kshramt-array-remove
… items from an array, #964
BREAKING CHANGE: removed enableAllPlugin, only Patch support is now optional
Pull Request Test Coverage Report for Build 4622958383Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
Just ran a quick check on 9.0.16 vs 10.0.beta, using Vite 4.2.1 +
If I hand-inspect the Vite bundle output, I don't see any If it helps at all, I just manually copied and pasted the minified versions of 9.0.16 and 10.0.0-beta.4 out of Vite-built bundles, ran them through Prettier, and am attaching them as a zip - maybe it'll help show where the differences are: Per the |
Ah interesting! Is there a documentation section I can refer people back to
if they report this in the future? RTK is probably the biggest packaged
Immer provider, so if that isn't even supposed to be done in that case,
happy to reconsider
…On Mon, Apr 3, 2023 at 6:11 PM Mark Erikson ***@***.***> wrote:
Just ran a quick check on 9.0.16 vs 10.0.beta, using Vite 4.2.1 +
source-map-explorer:
- 9.0.16: immer/dist/immer.esm.mjs, 10.42KB
- 10.0.0-beta.4: immer/dist/immer.mjs, 15.78KB
If I hand-inspect the Vite bundle output, I don't *see* any NODE_ENV
references left in there, which is what I would expect - they exist in the
ESM artifact, but the minifier should get rid of those.
If it helps at all, I just manually copied and pasted the minified
versions of 9.0.16 and 10.0.0-beta.4 out of Vite-built bundles, ran them
through Prettier, and am attaching them as a zip - maybe it'll help show
where the differences are:
immer-minified-prettified.zip
<https://github.com/immerjs/immer/files/11140726/immer-minified-prettified.zip>
Per the Map/Set thing: FWIW, we really *don't* want people using the
Map/Set support with RTK because of serialization issues, so at least in
our case that is a size increase we don't benefit from. But, I do
understand how that can cause confusion and annoyance on *your* side. (My
own preference would be that it still be opt-in somehow if possible.)
—
Reply to this email directly, view it on GitHub
<#1028 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBF56VRECVVNPETOLHTW7MADJANCNFSM6AAAAAAWFUJMLA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yeah, the two most immediate references are here:
We actually had an internal discussion about |
@markerikson I reverted the MapSet opt-in in [email protected], mind doing a check if it solves the bundle size increase? |
@mweststrate yeah, I'll check on that tonight! |
@mweststrate: Okay, 3 builds of the same RTKQ app, changing only the Immer version:
I'm still generally surprised that 10.x isn't smaller than 9.x, given the changes. |
@mweststrate : well, you got me hooked :) I cloned the
So, those are adding up to a bunch of dead bytes that aren't needed. Unrelated to the bundle sizes, there's also issues with the current build output in this beta:
FWIW, I just switched I just tried making a local branch that switches over to Some other notes here:
Sooooo, with all that said: If you're interested, I can try to do the rest of the TSDX -> Thoughts? |
@markerikson thanks for pointing out tsup! I was already wondering what was the modern bundling setup since tsdx went unmaintained, which was also the reason I didn't want to poke too much in the config. So happy to receive a PR! Please do leave the flow types, as they're useful inside Meta, so I try to keep them roughly up to date :) |
@mweststrate okay, sure! I'll try to put up a PR over the weekend. |
@mweststrate done! See #1032 . Please let me know if you have any questions or would like me to tweak things further! |
Sorry had some PTO and now playing really hard catch-up! I'll try to go
over it in the weekend :)
…On Mon, Apr 10, 2023 at 5:34 PM Mark Erikson ***@***.***> wrote:
@mweststrate <https://github.com/mweststrate> done! See #1032
<#1032> .
Please let me know if you have any questions or would like me to tweak
things further!
—
Reply to this email directly, view it on GitHub
<#1028 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBHGCON5TCPRRR2ELJLXAQR7JANCNFSM6AAAAAAWFUJMLA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@markerikson just published |
🎉 This PR is included in version 10.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Release notes
Proxy
,Reflect
,Symbol
andMap
andSet
.tsup
and modernize JS build artifacts #1032!getter
property in irrelevant plain objects #1012. Thanks hrsh7th for implementing it in [breaking change] implement and default to useStrictShallowCopy, omitting getters #941!createDraft
andfinishDraft
.enableES5()
, you SHOULD NOT upgrade Immer.enableES5
has been removed.produce
is no longer exposed as thedefault
export. This improves eco system compatibility, and makes sure that there is only one correct way of doing thingsenableAllPlugins
has been removed, useenablePatches(); enableMapSet()
insteadlength
property, in accordance with JSON spec. Thanks kshramt for implementing this in [breaking change] Do not replace array.length as patch when removing items #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
produce
has 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.createDraft
instead. Roughly: