From 1999c8874035528ceebb736206f83859bb6773e3 Mon Sep 17 00:00:00 2001 From: celine Date: Wed, 21 Jan 2026 22:32:17 -0500 Subject: [PATCH] fixed some undo redo bugs --- components/Pages/PageOptions.tsx | 2 +- src/replicache/clientMutationContext.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/Pages/PageOptions.tsx b/components/Pages/PageOptions.tsx index df608f46..561d1cf0 100644 --- a/components/Pages/PageOptions.tsx +++ b/components/Pages/PageOptions.tsx @@ -93,7 +93,7 @@ export const UndoButtons = () => { undoManager.undo()} + onClick={() => undoManager.redo()} disabled={!undoState.canRedo} > diff --git a/src/replicache/clientMutationContext.ts b/src/replicache/clientMutationContext.ts index d6c1584f..edc87fed 100644 --- a/src/replicache/clientMutationContext.ts +++ b/src/replicache/clientMutationContext.ts @@ -67,6 +67,13 @@ export function clientMutationContext( textData.value = base64.fromByteArray(updateBytes); } } + } else if (f.id) { + // For cardinality "many" with an explicit ID, fetch the existing fact + // so undo can restore it instead of deleting + let fact = await tx.get(f.id); + if (fact) { + existingFact = [fact as Fact]; + } } if (!ignoreUndo) undoManager.add({ -- 2.51.2