From 9839afd3bfcff34b7b144d3527b9e12321a1e9c0 Mon Sep 17 00:00:00 2001 From: Adam Martin Date: Tue, 11 Aug 2026 15:33:22 -0500 Subject: [PATCH] fix: Maximum update depth reached do to hook dependency --- apps/web/src/components/note-editor.tsx | 4 +--- packages/editor/src/types.ts | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/note-editor.tsx b/apps/web/src/components/note-editor.tsx index 0bb5ec7..ad107d8 100644 --- a/apps/web/src/components/note-editor.tsx +++ b/apps/web/src/components/note-editor.tsx @@ -610,9 +610,7 @@ export function NoteEditor({ path={path} value={content} onChange={handleChange} - onRegisterContextMenu={(builder) => - setNoteViewCtxBuilder(builder as NoteViewContextMenuBuilder | null) - } + onRegisterContextMenu={setNoteViewCtxBuilder} /> )} {showRendered && !noteRenderer && ( diff --git a/packages/editor/src/types.ts b/packages/editor/src/types.ts index 416ee09..3ae4be7 100644 --- a/packages/editor/src/types.ts +++ b/packages/editor/src/types.ts @@ -1,4 +1,5 @@ -import type { ReactNode } from "react"; +import type { NoteViewContextMenuBuilder } from "@notes/ui"; +import type { Dispatch, ReactNode, SetStateAction } from "react"; /** The three editor modes available for a note-type view. */ export type EditorMode = "edit" | "split" | "rendered"; @@ -127,5 +128,5 @@ export interface RendererProps { * Pass null (or call with null at cleanup) to unregister. * Typed as unknown[] to avoid importing @notes/ui here; consumers cast to ContextMenuEntry[]. */ - onRegisterContextMenu?: (builder: ((target: Element | null) => unknown[] | null) | null) => void; + onRegisterContextMenu?: Dispatch>; }