Modifying subsets of resources, not re-rendering

I'm struggling with updating a subset of a resource, and using mutate to mark it as changed. my code is more complex but I think it's the same as this minimal example: https://playground.solidjs.com/anonymous/6c48c136-2c08-47b6-99a0-8b91068ccafa I suppose my question is, when updating a resource which is a list of items (which I guess are all individual signals), who do I update just one of those items, and trigger a UI re-render accordingly?
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
1 Reply
devagr
devagr4w ago
you'll have to make it an immutable update so that the object reference changes.
peopleActions.mutate((people) => {
people.map((p) => {
if (p.url == personToRemove.url) {
console.log(`deleting ${p.name}`);
return { ...p, deleted: true };
}
return p;
});
return people;
});
peopleActions.mutate((people) => {
people.map((p) => {
if (p.url == personToRemove.url) {
console.log(`deleting ${p.name}`);
return { ...p, deleted: true };
}
return p;
});
return people;
});
this should trigger the re-render as you expect
Want results from more Discord servers?
Add your server