tinyplex / tinybase

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

Consider providing value of entity in iterators #39

Closed jamesgpearce closed 1 year ago

jamesgpearce commented 1 year ago

eg, in https://tinybase.org/api/store/type-aliases/callback/rowcallback/ change from

(
  rowId: Id,
  forEachCell: (cellCallback: CellCallback) => void,
): void

to

(
  rowId: Id,
  forEachCell: (cellCallback: CellCallback) => void,
  row: Row, // <- add this
): void

Via @founderYonz

jamesgpearce commented 1 year ago

I have decided not to add this since it adds a performance overhead for every usage of these iterator functions, even if people don't need the direct value of the entity.

Instead, just call getRow(tableId, rowId) in your callback if you need it.