Skip to content

Commit 1a55c49

Browse files
masonwyatt23claude
andcommitted
fix: review findings — persist applyAttributedOp entries to recoverable OT log
applyAttributedOp appended to the in-memory opLog but never called useOtLogStore.append(), so reconnecting agents read an empty persisted log and session recovery was dead. Now persist each logEntry to useOtLogStore after the set(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 68eaa74 commit 1a55c49

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/store/documentStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
type OtLogEntry,
1212
type OtOperation,
1313
} from "../lib/ot";
14+
import { useOtLogStore } from "./memoryStore";
1415
import { useRecentStore } from "./recentStore";
1516
import { toast } from "./toastStore";
1617

@@ -387,6 +388,9 @@ export const useDocumentStore = create<DocumentState>((set, get) => ({
387388
tabs: syncActiveTab(next),
388389
};
389390
});
391+
// Persist to the recoverable OT log so reconnecting agents can replay
392+
// operations without re-downloading the document.
393+
useOtLogStore.getState().append(logEntry);
390394
return true;
391395
} catch {
392396
return false;

0 commit comments

Comments
 (0)