nanoclone
nanoclone copied to clipboard
[Bug] nanoclone makes vuex state props move onto the prototype
I have a weird bug where if I copy my vuex store with nanoclone (I called it copyObj
) it will change all the values of the original store and move the MODULE state props onto the prototype. Not the root state props though...
First console.log above prints the module state props. The second one doesn't, and upon inspection they are moved to the prototype...
Strange thing. I'll check it on weekends (sry for this delay).
Here is the bug on Codepen, reproduced in it's simplest form: https://codepen.io/mesqueeb/pen/XYOoOy?editors=0011
This is one of the reasons I can't use nanoclone in my project. Having the props moved to the prototype is a big problem for me.
Also I'm quite afraid what kind of effect this might have on other dependants like nanomerge.
Not sure how I missed this issue, but it's because nanoclone
is using Object.create which uses the old object as the prototype.
I got around this on my fork, see: https://github.com/ianwalter/clone
I ended up writing my own clone function: copy-anything