understanding store setter updates
In this example:
for the "without produce" case, would two dependency updates be triggered?
5 Replies
yep, needs
batch
to batch updatesJust to confirm, would it look like this?
Do you have a sense of which method is generally more preferred within Solid,
produce
or batch
?setStore('users', 0, () => ({ username: 'newUserName', location: 'newLocation' }))
will also result in 1 updateyes, that's just it.
setStore("users", 0, { username: "newUsername", location: "newLocation" })
is also an option as the object gets shallow merged
yeah, similar to what bigmistqke posted 😄
for 2nd question, IMO produce
is way more easier as it's just regular mutation updates
there are awkward things with just setStore
like deleting a property is done with undefined
, adding/removing array elements in the middle requires splitting, merging the arrayI appreciate the advice 💚