Skip to content

Commit 70fc963

Browse files
backnotpropclaude
andcommitted
fix: wrap handleRestoreDraft in useCallback and update shared-handlers comment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3df3e5d commit 70fc963

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/editor/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ const App: React.FC = () => {
535535
submitted: !!submitted,
536536
});
537537

538-
const handleRestoreDraft = () => {
538+
const handleRestoreDraft = React.useCallback(() => {
539539
const { annotations: restored, globalAttachments: restoredGlobal } = restoreDraft();
540540
if (restored.length > 0) {
541541
setAnnotations(restored);
@@ -545,7 +545,7 @@ const App: React.FC = () => {
545545
viewerRef.current?.applySharedAnnotations(restored);
546546
}, 100);
547547
}
548-
};
548+
}, [restoreDraft]);
549549

550550
// Fetch available agents for OpenCode (for validation on approve)
551551
const { agents: availableAgents, validateAgent, getAgentWarning } = useAgents(origin);

packages/server/shared-handlers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/**
22
* Shared route handlers used by plan, review, and annotate servers.
33
*
4-
* Eliminates duplication of /api/image, /api/upload, and the server-ready
5-
* handler across all three server files. Also shares /api/agents for plan + review.
4+
* Eliminates duplication of /api/image, /api/upload, /api/draft, and the
5+
* server-ready handler across all three server files. Also shares /api/agents
6+
* for plan + review.
67
*/
78

89
import { mkdirSync } from "fs";

0 commit comments

Comments
 (0)