Local command log and replay
experimental
Capture committed grid changes in a bounded JSON log and replay them into a fresh instance.
Live example
Expected behavior
Replay restores the same state when the full sequence is retained. The oldest batches are evicted as the log reaches its limit.
Source
const api = createGrid({ rows, columns, commandLog: true });
api.setSelection(['two']);
api.flush();
const saved = JSON.stringify(api.getCommandLog());
freshGrid.replay(JSON.parse(saved));const api = createGrid({ rows, columns, commandLog: true });
api.setSelection(['two']);
api.flush();
const saved = JSON.stringify(api.getCommandLog());
freshGrid.replay(JSON.parse(saved));const api = createGrid({ rows, columns, commandLog: true });
api.setSelection(['two']);
api.flush();
const saved = JSON.stringify(api.getCommandLog());
freshGrid.replay(JSON.parse(saved));const api = createGrid({ rows, columns, commandLog: true });
api.setSelection(['two']);
api.flush();
const saved = JSON.stringify(api.getCommandLog());
freshGrid.replay(JSON.parse(saved));// JavaScript interop module
const api = createGrid({ rows, columns, commandLog: true });
api.setSelection(['two']);
api.flush();
const saved = JSON.stringify(api.getCommandLog());
freshGrid.replay(JSON.parse(saved));API reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Method | getCommandLog | — | Copies versioned, serializable batches without making a network request. |
| Method | replay | — | Applies recorded commands in sequence, preserving commit boundaries. |
| Method | setCommandLogLimit | — | Keeps the most recent batches within the chosen limit. |
| Method | clearCommandLog | — | Removes the recorded batches without changing grid state. |