MCPcopy Index your code
hub / github.com/tinyplex/tinybase / writeGroupRow

Function writeGroupRow

docs/pseudo.esm.sh/tinybase@9.0.0/index.js:3477–3523  ·  view source on GitHub ↗
(leaf, changedGroupedSelectedCells, selectedRowId, forceRemove)

Source from the content-addressed store, hash-verified

3475 );
3476 const tree = mapNew();
3477 const writeGroupRow = (leaf, changedGroupedSelectedCells, selectedRowId, forceRemove) => ifNotUndefined(
3478 leaf,
3479 ([selectedCells, selectedRowIds, groupRowId, groupRow]) => {
3480 mapForEach(
3481 changedGroupedSelectedCells,
3482 (selectedCellId, [newCell]) => {
3483 const selectedCell = mapEnsure(
3484 selectedCells,
3485 selectedCellId,
3486 mapNew
3487 );
3488 const oldLeafCell = mapGet(selectedCell, selectedRowId);
3489 const newLeafCell = forceRemove ? void 0 : newCell;
3490 if (oldLeafCell !== newLeafCell) {
3491 const oldNewSet = setNew([[oldLeafCell, newLeafCell]]);
3492 const oldLength = collSize(selectedCell);
3493 mapSet(selectedCell, selectedRowId, newLeafCell);
3494 collForEach(
3495 mapGet(groupedSelectedCellIds, selectedCellId),
3496 ([groupedCellId, aggregators]) => {
3497 const aggregateValue = getAggregateValue(
3498 groupRow[groupedCellId],
3499 oldLength,
3500 selectedCell,
3501 oldNewSet,
3502 aggregators
3503 );
3504 groupRow[groupedCellId] = isUndefined(
3505 getCellOrValueType(aggregateValue)
3506 ) ? void 0 : aggregateValue;
3507 }
3508 );
3509 }
3510 }
3511 );
3512 if (collIsEmpty(selectedRowIds) || !arrayEvery(
3513 havings,
3514 (having2) => having2((cellId) => groupRow[cellId])
3515 )) {
3516 resultStore2.delRow(queryId, groupRowId);
3517 } else if (isUndefined(groupRowId)) {
3518 leaf[2] = resultStore2.addRow(queryId, groupRow);
3519 } else {
3520 resultStore2.setRow(queryId, groupRowId, groupRow);
3521 }
3522 }
3523 );
3524 addPreStoreListener(
3525 selectJoinWhereStore,
3526 queryId,

Callers 1

setQueryDefinitionImplFunction · 0.70

Calls 15

mapForEachFunction · 0.70
mapEnsureFunction · 0.70
mapGetFunction · 0.70
setNewFunction · 0.70
collSizeFunction · 0.70
mapSetFunction · 0.70
collForEachFunction · 0.70
getAggregateValueFunction · 0.70
isUndefinedFunction · 0.70
getCellOrValueTypeFunction · 0.70
collIsEmptyFunction · 0.70
arrayEveryFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…