tinyplex / tinybase

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

Append new cell to an existing row #8

Closed AsaoluElijah closed 2 years ago

AsaoluElijah commented 2 years ago

Is your feature request related to a problem? Please describe.

The .setCell() should update an existing row if it already exist and not replace it. Or, maybe a .appendRow() method?

If i've defined a table like below for example:

import { createStore } from "tinybase";
const store = createStore();

store.setTable("books", {
  1: {
    title: "Book Title",
    author: "John Doe",
  },
});

And, i do:

store.setCell("books", 1, "price", "$15");

This should replace the entire row with the new cell, rather than update it.

Describe the solution you'd like If i use the .setCell() function for an existing row, it should update the row.

Describe alternatives you've considered Or maybe a .appendRow() function to append new cells to a row

AsaoluElijah commented 2 years ago

Wonderful project by the way 💯🙂