Closed darkdread closed 1 year ago
Just FYI, the localStorage back-end also doesn't seem to do a clone there...
Nodes are objects, and objects are mutable in JavaScript.
When we store nodes in localStorage, we stringify the object. When we get nodes from localStorage, we parse the string back into an object. This makes the node immutable, which means modifying the node outside of getNodes
will not mutate localStorage, because the object reference is not referencing the node in localStorage.
What we have initially in inmemorystorage however, was referencing the node stored in this_storage
, which means modifying any node outside of getNodes
will modify the node in this_storage
.
Getting a node in memory storage should clone whatever it was holding to prevent data mutation.
fixes #1281