(
tableId: Id,
rowId: Id,
cellId: Id,
cell: Cell | MapCell,
skipMiddleware?: boolean,
skipRowMiddleware?: boolean,
)
| 1626 | ); |
| 1627 | |
| 1628 | const setCell = ( |
| 1629 | tableId: Id, |
| 1630 | rowId: Id, |
| 1631 | cellId: Id, |
| 1632 | cell: Cell | MapCell, |
| 1633 | skipMiddleware?: boolean, |
| 1634 | skipRowMiddleware?: boolean, |
| 1635 | ): Store => |
| 1636 | fluentTransaction( |
| 1637 | (tableId, rowId, cellId) => |
| 1638 | ifNotUndefined( |
| 1639 | getValidatedCell( |
| 1640 | tableId, |
| 1641 | rowId, |
| 1642 | cellId, |
| 1643 | isFunction(cell) ? cell(getCell(tableId, rowId, cellId)) : cell, |
| 1644 | ), |
| 1645 | (validCell) => { |
| 1646 | const tableMap = getOrCreateTable(tableId); |
| 1647 | ifNotUndefined( |
| 1648 | skipMiddleware || skipRowMiddleware || !middleware[14]?.() |
| 1649 | ? undefined |
| 1650 | : middleware[3], |
| 1651 | (willSetRow) => { |
| 1652 | const existingRowMap = mapGet(tableMap, rowId); |
| 1653 | const prospectiveRow: Row = { |
| 1654 | ...(existingRowMap ? mapToObj<Cell>(existingRowMap) : {}), |
| 1655 | [cellId]: validCell, |
| 1656 | }; |
| 1657 | ifNotUndefined( |
| 1658 | whileMutating(() => |
| 1659 | willSetRow(tableId, rowId, structuredClone(prospectiveRow)), |
| 1660 | ), |
| 1661 | (row) => |
| 1662 | applyRowDirectly( |
| 1663 | tableId, |
| 1664 | tableMap, |
| 1665 | rowId, |
| 1666 | row, |
| 1667 | skipMiddleware, |
| 1668 | ), |
| 1669 | ); |
| 1670 | }, |
| 1671 | () => |
| 1672 | setCellIntoNewRow( |
| 1673 | tableId, |
| 1674 | tableMap, |
| 1675 | rowId, |
| 1676 | cellId, |
| 1677 | validCell, |
| 1678 | skipMiddleware, |
| 1679 | ), |
| 1680 | ); |
| 1681 | }, |
| 1682 | ), |
| 1683 | tableId, |
| 1684 | rowId, |
| 1685 | cellId, |
searching dependent graphs…