tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.71k stars 77 forks source link

Object-based hooks should return same ref if unchanged #151

Closed jamesgpearce closed 2 months ago

jamesgpearce commented 3 months ago

useTable, useRow, useValues etc will return a new object even if the content has not changed since the last render. Instead, they should be the same object (by reference) until the data changes.

h/t @cpojer

jamesgpearce commented 3 months ago

Fixed in https://github.com/tinyplex/tinybase/releases/tag/v5.0.1 with test case. @cpojer - please ensure this is what you meant.

See the commit. I am not now entirely sure why I went to all that effort to clone a fresh object each time, but the tests still pass!

cpojer commented 3 months ago

Huge if true! I'll verify within the next week. Thank you 🙇‍♂️

cpojer commented 2 months ago

Yes it's working! This is a great improvement, thank you 🙇‍♂️