@mmstack/primitives 20.3.0 → 20.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -218,7 +218,7 @@ function derived(source, optOrKey, opt) {
|
|
|
218
218
|
source.update((cur) => ({ ...cur, [optOrKey]: next }));
|
|
219
219
|
};
|
|
220
220
|
const rest = typeof optOrKey === 'object' ? optOrKey : opt;
|
|
221
|
-
|
|
221
|
+
const baseEqual = rest?.equal ?? Object.is;
|
|
222
222
|
let trigger = false;
|
|
223
223
|
const equal = isMutable(source)
|
|
224
224
|
? (a, b) => {
|
|
@@ -1363,6 +1363,8 @@ function withHistory(source, opt) {
|
|
|
1363
1363
|
return;
|
|
1364
1364
|
const valueForRedo = untracked(source);
|
|
1365
1365
|
const valueToRestore = historyStack.at(-1);
|
|
1366
|
+
if (valueToRestore === undefined)
|
|
1367
|
+
return;
|
|
1366
1368
|
originalSet.call(source, valueToRestore);
|
|
1367
1369
|
history.inline((h) => h.pop());
|
|
1368
1370
|
redoArray.inline((r) => r.push(valueForRedo));
|
|
@@ -1373,6 +1375,8 @@ function withHistory(source, opt) {
|
|
|
1373
1375
|
return;
|
|
1374
1376
|
const valueForUndo = untracked(source);
|
|
1375
1377
|
const valueToRestore = redoStack.at(-1);
|
|
1378
|
+
if (valueToRestore === undefined)
|
|
1379
|
+
return;
|
|
1376
1380
|
originalSet.call(source, valueToRestore);
|
|
1377
1381
|
redoArray.inline((r) => r.pop());
|
|
1378
1382
|
history.mutate((h) => {
|