-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Svelte 5 reactivity is very complicated and convoluted. Its initial simplicity is misleading when working with complex data structures that are not designed with svelte in mind, like our Resource class.
To combat this we already use some hacks to change the resources reference whenever there is a change to its data. But if something changes that does not trigger a LocalChange event there won't be anything to let svelte know to re-render.
Most of the time these fields are updated due to a change in propvals so a LocalChange event is triggered the reference changes. But there are some cases where this is not true which leads to weird edge cases.
I'll have to dive deeper into this to know exactly what these edge cases are and if there is a general solution that would just make the whole object reactive.
let resourceA = getResource(() => "some-subject");
let subjectB = $derived(resourceA.get("some-prop");
let resourceB = getResource(() => subjectB);
let subject = $derived(resourceB.subject) // always stays unknownSubject