Closed SergkeiM closed 7 months ago
@jessarcher @claudiodekker FYI
@jessarcher @reinink When do we think this could be looked at and potentially merged? I need this issue resolved asap and if this does indeed resolve the issue without any problems then I am +1 on getting this merge asap.
Hey! As noted in #1792 as well, thanks for this suggestion, but I think we're going to stick with lodash
for now because this is just too risky of a change as there could be unexpected side effects for not a lot of gain. Might revisit this in the future, but for now going to leave it as is 👍
Hey @reinink! 👋🏻
To avoid any unexpected side effects, you could release a beta version with those changes and see if anyone come with an issue. Since it is an easy change, it is also easily revertable.
Looking at the source code and test suite, it seems to be 100% compatible. Also, looking at the usage of lodash.isequal
, the native structuredClone
function may be enougth.
Hi @RomainLanz, @reinink
Agree, having lodash.isequal
and lodash.clonedeep
removed, saves 7.1kB min + gzip combined, this is more then 50% of vue 3
size (13.5kb)
Hi @reinink
The purpose of this PR is to reduce the size of
inertiajs
.If we check the size of @inertiajs/inertia-vue3
75% - belongs to
lodash.isequal
(3.8kB min + gzip) andlodash.clonedeep
(3.3kB min + gzip)In this PR:
lodash.isequal
is replaced by just-compare (419B min + gzip)lodash.clonedeep
is replaced by just-clone (410B min + gzip)Note: I have a custom build of
inertia/vue3
with these 2 libraries and didn't had any issues so far.Differences with Lodash:
lodash.clonedeep
-Lodash
can merge circular references,just-clone
only merges plain objects, regular arrays, functions and primitivesLodash
merges additional non-plain object types,Lodash
treats sparse arrays as dense