get-convex / convex-svelte

https://convex-svelte.vercel.app
Apache License 2.0
21 stars 5 forks source link

Deeply reactive query result #2

Open thomasballinger opened 5 months ago

thomasballinger commented 5 months ago

The React client doesn't do this either yet, but it would nice to provide fine-grained reactivity by diffing query results to produce a series of modifications on a deeply reactive Svelte object.

thomasballinger commented 5 months ago

I looked into this a little, something like https://github.com/benjamine/jsondiffpatch could be used. This could look like

We could use _id as the identity heuristic in arrays.

List views are the number one use case here, a first pass could operate only on query results that are arrays at the top level.

thomasballinger commented 4 months ago

TanStack query calls this "structural sharing," so it's sort of a normal thing to provide. Curious how svelte-query implements it.