[Solved] Change store object using reconcile
I am not sure if I am using the api wrongly. But my case is very simple I am trying to build a filexplorer component and I have the following code.
6 Replies
When the
intoDir
function is called the current
store object is not replaced with the new object, rather it for some reason is merging
both objects which I am having a hard time understanding.
My input to this component fs
is simply an Object with string
keys and values that are string
or another Object
signifying a directoryInitially (i have clicked the
test
directory) it should just become { a: "...", b: "...", c: "..."}
What is happening
I have tried deep copying, shallow copying it doesnt help
I tried to set the store to an empty object which for some reason didn't do anything
looking at the code there are really no side effects that is causing that state to change either
From the docs:
When using store setters to modify objects, if a new value is an object, it will be shallow merged with the existing valueTo completely replace a store, wrap the value in
reconcile
Okay, that solves it
Thanks!