Open
Description
Describe the bug
Yesterday I've got a fix merged, that was related to this. And it seems to work almost perfectly except for one strange case.
There is one place in our code that is still failing. I can see why it's happening, but I've spent several hours today trying to create a failing test for it without any success.
In the following code calls to map.set
in the first loop are working just fine without any issues. However the last call triggers state_unsafe_mutation
.
class Chat {
adminParticipants: $derived.by(() => {
const map = new SvelteMap();
for (const [id, apiAdmin] of Object.entries(this.$.adminParticipants ?? {})) {
const contactId = AbstractContact.resolveId(+id);
map.set(contactId, AdminParticipant.fromApi(this.pool, apiAdmin));
}
if (this.ownerId) {
// state_unsafe_mutation is happening on this .set
map.set(
this.ownerId,
AdminParticipant.fromApi(this.pool, {
id: this.ownerId,
permissions: Number.MAX_SAFE_INTEGER,
}),
);
}
return map;
});
}
Here you can see how it looks in the debugger - reaction_sources
do not include source
for some reason.
Reproduction
Would love to have one, but seems like I need help
Logs
System Info
Using version from this PR: https://github.com/sveltejs/svelte/pull/16221
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels