TinyBase logoTinyBase


The setPartialRow method takes an object and sets partial data of a single Row in the Store, leaving other Cell values unaffected.

  tableId: Id,
  rowId: Id,
  partialRow: Row,
): Store

The Id of the Table in the Store.


The Id of the Row in the Table.


The partial data of a single Row to be set.


A reference to the Store.

This method will cause listeners to be called for any Table, Row, Cell, or Id changes resulting from it.

Any part of the provided object that is invalid (either according to the Row type, or because, when combined with the current Row data, it does not match a TablesSchema associated with the Store), will be ignored silently.

Assuming that at least some of the provided Row object is valid, it will be merged with the data that was already present in the Store. If the object is completely invalid, no change will be made to the Store.

The method returns a reference to the Store so that subsequent operations can be chained in a fluent style.


This example sets some of the data of a single Row.

const store = createStore().setTables({
  pets: {fido: {species: 'dog', color: 'brown'}},
store.setPartialRow('pets', 'fido', {color: 'walnut', visits: 1});
// -> {pets: {fido: {species: 'dog', color: 'walnut', visits: 1}}}

This example attempts to set some of the data of an existing Store with partly invalid, and then completely invalid, Row objects.

const store = createStore().setTables({pets: {fido: {species: 'dog'}}});

store.setPartialRow('pets', 'fido', {color: 'brown', bug: []});
// -> {pets: {fido: {species: 'dog', color: 'brown'}}}

store.setPartialRow('pets', 'fido', 42);
// -> {pets: {fido: {species: 'dog', color: 'brown'}}}