Skip to content

Commit 1b4876c

Browse files
committed
[middleware] Fix getOrCreateTable
1 parent bb2ba4c commit 1b4876c

2 files changed

Lines changed: 434 additions & 1 deletion

File tree

‎src/store/index.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,12 @@ export const createStore: typeof createStoreDecl = (): Store => {
683683
};
684684

685685
const getOrCreateTable = (tableId: Id) =>
686-
mapGet(tablesMap, tableId) ?? setValidTable(tableId, {});
686+
mapEnsure(tablesMap, tableId, () => {
687+
tableIdsChanged(tableId, 1);
688+
mapSet(tablePoolFunctions, tableId, getPoolFunctions());
689+
mapSet(tableCellIds, tableId, mapNew());
690+
return mapNew();
691+
});
687692

688693
const delValidTable = (tableId: Id): TableMap => {
689694
if (middleware[8]?.(tableId) ?? true) {

0 commit comments

Comments
 (0)