I'm sure this is a stupid question...

I have a a situation where I want to take the current state of part of a store, and create a new store based on said state, which won't affect the original store. This is my current attempt:
const [statStore, setStatStore] = createStore(
unwrap(systemStore.stats),
);
const [statStore, setStatStore] = createStore(
unwrap(systemStore.stats),
);
I really thought that the unwrap would detach the data from its parent, but I can see there's still some Symbol(solid-proxy): values going on. Do I need to, like, deeply unwrap the data?
3 Replies
Lumphammer (Neil de Carteret)
Solved it with a JSON.parse(JSON.stringify(x)) as typeof x 🤷‍♂️
Madaxen86
Madaxen86•11h ago
const [store, setStore] = createStore(initial);
const [nested] = createStore({ ...store });
const [store, setStore] = createStore(initial);
const [nested] = createStore({ ...store });
Lumphammer (Neil de Carteret)
That wouldn’t unlink it deeply though, right?

Did you find this page helpful?