jazz
jazz copied to clipboard
Add granular reactivity that matches Svelte's reactivity model
We don't have to use the same reactivity model as React, as we have deep-reactivity supported as part of Svelte's runes.
We can deviate from jazz-react here.
Looking at the Svelte docs related to the runes: https://svelte.dev/docs/svelte/$state#Deep-state
Seems to me that to handle fine-grained reactivity we need:
- To get rid of our proxies (should come with the next API iteration)
- To build a subscribe system that mutates the nested values instead of regenerating them from scratch. We can start by aiming to object-level reactivity by hacking with the subscription scope. We actually already do nested subscriptions there so achieving this should be fairly easy.
- In the future we can also aim to property level reactivity for specific classes (e.g. CoMap) we just need a way to notify which keys have changed in each update.
This highlights that Jazz can be actually very good at this, making fine-grained reactivity quite effortless for the end-users.