Describe the bug
Cancelling the pending changes in one data domain can make Checkpoints treat the Store as unchanged even though the other domain still has changes. The next addCheckpoint() returns the previous ID, and undo does not revert the remaining change.
Steps to Reproduce the Bug or Issue
import {createCheckpoints, createStore} from 'tinybase';
const store = createStore().setValue('count', 0).setCell('pets', 'fido', 'age', 0);
const checkpoints = createCheckpoints(store);
store.setValue('count', 1);
store.setCell('pets', 'fido', 'age', 1);
store.setCell('pets', 'fido', 'age', 0);
console.log(checkpoints.addCheckpoint()); // '0', rather than a new checkpoint
checkpoints.goBackward();
console.log(store.getValue('count')); // 1, expected 0
checkpoints.destroy();
The symmetric case also fails: keep a cell change pending while changing a keyed value and then restoring it. Creating and deleting the temporary cell/value exhibits the same problem.
Expected behavior
The Store should remain between checkpoints until both tabular and keyed-value changes are cancelled. A new checkpoint should retain the outstanding change for undo and redo.
Platform
- Windows, Node.js v24.14.1
- Current main:
f09e5a3b74ea16b6fac93439be34cc3f954f1e7c (package version 9.7.0)
- Reproduced against source; regression tests also run against the native test build.
Additional context
Both listener paths call storeUnchanged() when their own delta map becomes empty without checking the other delta map. Checking both maps preserves the existing API and only changes this incorrect mixed-data checkpoint transition.
Describe the bug
Cancelling the pending changes in one data domain can make Checkpoints treat the Store as unchanged even though the other domain still has changes. The next
addCheckpoint()returns the previous ID, and undo does not revert the remaining change.Steps to Reproduce the Bug or Issue
The symmetric case also fails: keep a cell change pending while changing a keyed value and then restoring it. Creating and deleting the temporary cell/value exhibits the same problem.
Expected behavior
The Store should remain between checkpoints until both tabular and keyed-value changes are cancelled. A new checkpoint should retain the outstanding change for undo and redo.
Platform
f09e5a3b74ea16b6fac93439be34cc3f954f1e7c(package version 9.7.0)Additional context
Both listener paths call
storeUnchanged()when their own delta map becomes empty without checking the other delta map. Checking both maps preserves the existing API and only changes this incorrect mixed-data checkpoint transition.