MCPcopy
hub / github.com/tinyplex/tinybase / cellIdsChanged

Function cellIdsChanged

src/store/index.ts:982–1015  ·  view source on GitHub ↗
(
    tableId: Id,
    rowId: Id,
    cellId: Id,
    addedOrRemoved: IdAddedOrRemoved,
  )

Source from the content-addressed store, hash-verified

980 );
981
982 const cellIdsChanged = (
983 tableId: Id,
984 rowId: Id,
985 cellId: Id,
986 addedOrRemoved: IdAddedOrRemoved,
987 ): void => {
988 const cellIds = mapGet(tableCellIds, tableId);
989 const count = mapGet(cellIds, cellId) ?? 0;
990 if (
991 (count == 0 && addedOrRemoved == 1) ||
992 (count == 1 && addedOrRemoved == -1)
993 ) {
994 idsChanged(
995 mapEnsure(changedTableCellIds, tableId, mapNew) as ChangedIdsMap,
996 cellId,
997 addedOrRemoved,
998 );
999 }
1000 mapSet(
1001 cellIds,
1002 cellId,
1003 count != -addedOrRemoved ? count + addedOrRemoved : undefined,
1004 );
1005
1006 idsChanged(
1007 mapEnsure(
1008 mapEnsure(changedCellIds, tableId, mapNew) as ChangedIdsMap2,
1009 rowId,
1010 mapNew,
1011 ) as ChangedIdsMap,
1012 cellId,
1013 addedOrRemoved,
1014 );
1015 };
1016
1017 const cellChanged = (
1018 tableId: Id,

Callers 2

setValidCellFunction · 0.70
delCellFunction · 0.70

Calls 4

mapGetFunction · 0.90
mapEnsureFunction · 0.90
mapSetFunction · 0.90
idsChangedFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…