(doRollback?: DoRollback)
| 1939 | ]; |
| 1940 | |
| 1941 | const finishTransaction = (doRollback?: DoRollback): Store => { |
| 1942 | if (transactions > 0) { |
| 1943 | transactions--; |
| 1944 | |
| 1945 | if (transactions == 0) { |
| 1946 | transactions = 1; |
| 1947 | |
| 1948 | whileMutating(() => { |
| 1949 | callInvalidCellListeners(1); |
| 1950 | if (!collIsEmpty(changedCells)) { |
| 1951 | callTabularListenersForChanges(1); |
| 1952 | } |
| 1953 | callInvalidValueListeners(1); |
| 1954 | if (!collIsEmpty(changedValues)) { |
| 1955 | callValuesListenersForChanges(1); |
| 1956 | } |
| 1957 | }); |
| 1958 | |
| 1959 | if (doRollback?.(store)) { |
| 1960 | collForEach(changedCells, (table, tableId) => |
| 1961 | collForEach(table, (row, rowId) => |
| 1962 | collForEach(row, ([oldCell], cellId) => |
| 1963 | setOrDelCell(tableId, rowId, cellId, oldCell, true), |
| 1964 | ), |
| 1965 | ), |
| 1966 | ); |
| 1967 | collClear(changedCells); |
| 1968 | collForEach(changedValues, ([oldValue], valueId) => |
| 1969 | setOrDelValue(valueId, oldValue, true), |
| 1970 | ); |
| 1971 | collClear(changedValues); |
| 1972 | } |
| 1973 | |
| 1974 | callListeners(finishTransactionListeners[0], undefined); |
| 1975 | |
| 1976 | transactions = -1; |
| 1977 | callInvalidCellListeners(0); |
| 1978 | if (!collIsEmpty(changedCells)) { |
| 1979 | callTabularListenersForChanges(0); |
| 1980 | } |
| 1981 | callInvalidValueListeners(0); |
| 1982 | if (!collIsEmpty(changedValues)) { |
| 1983 | callValuesListenersForChanges(0); |
| 1984 | } |
| 1985 | internalListeners[1]?.(); |
| 1986 | callListeners(finishTransactionListeners[1], undefined); |
| 1987 | internalListeners[2]?.(); |
| 1988 | |
| 1989 | transactions = 0; |
| 1990 | hadTables = hasTables(); |
| 1991 | hadValues = hasValues(); |
| 1992 | arrayForEach( |
| 1993 | [ |
| 1994 | changedTableIds, |
| 1995 | changedTableCellIds, |
| 1996 | changedRowCount, |
| 1997 | changedRowIds, |
| 1998 | changedCellIds, |
no test coverage detected
searching dependent graphs…