jazz icon indicating copy to clipboard operation
jazz copied to clipboard

Add granular reactivity that matches Svelte's reactivity model

Open bensleveritt opened this issue 1 year ago • 1 comments

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.

bensleveritt avatar Dec 04 '24 16:12 bensleveritt

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.

gdorsi avatar Dec 05 '24 09:12 gdorsi