TinyBase logoTinyBase

ChangedCells

The ChangedCells type describes the Cell values that have been changed during a transaction, primarily used so that you can indicate whether the transaction should be rolled back.

{[tableId: Id]: {[rowId: Id]: {[cellId: Id]: ChangedCell}}}

A ChangedCells object is provided to the doRollback callback when using the transaction method and the finishTransaction method. See those methods for specific examples.

This type is a nested structure of Table, Row, and Cell objects, much like the Tables object, but one which provides both the old and new Cell values in a two-part array. These are describing the state of each changed Cell in Store at the start of the transaction, and by the end of the transaction.

Hence, an undefined value for the first item in the array means that the Cell was added during the transaction. An undefined value for the second item in the array means that the Cell was removed during the transaction. An array with two different Cell values indicates that it was changed. The two-part array will never contain two items of the same value (including two undefined values), even if, during the transaction, a Cell was changed to a different value and then changed back.

Since

v1.2.0