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

Function cellChanged

src/store/index.ts:1017–1047  ·  view source on GitHub ↗
(
    tableId: Id,
    rowId: Id,
    cellId: Id,
    oldCell?: CellOrUndefined,
    newCell?: CellOrUndefined,
  )

Source from the content-addressed store, hash-verified

1015 };
1016
1017 const cellChanged = (
1018 tableId: Id,
1019 rowId: Id,
1020 cellId: Id,
1021 oldCell?: CellOrUndefined,
1022 newCell?: CellOrUndefined,
1023 ): void => {
1024 const defaulted =
1025 collHas(mapGet(mapGet(defaultedCells, tableId), rowId), cellId) &&
1026 isUndefined(oldCell)
1027 ? 1
1028 : 0;
1029 mapEnsure<Id, ChangedCell>(
1030 mapEnsure<Id, IdMap<ChangedCell>>(
1031 mapEnsure<Id, IdMap2<ChangedCell>>(changedCells, tableId, mapNew),
1032 rowId,
1033 mapNew,
1034 ),
1035 cellId,
1036 () => [oldCell, 0],
1037 )[1] = newCell;
1038 internalListeners[3]?.(
1039 tableId,
1040 rowId,
1041 cellId,
1042 newCell,
1043 mutating,
1044 defaulted,
1045 );
1046 collDel(mapGet(mapGet(defaultedCells, tableId), rowId), cellId);
1047 };
1048
1049 const valueIdsChanged = (
1050 valueId: Id,

Callers 2

setValidCellFunction · 0.70
delCellFunction · 0.70

Calls 5

collHasFunction · 0.90
mapGetFunction · 0.90
isUndefinedFunction · 0.90
mapEnsureFunction · 0.90
collDelFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…