From f5a87ab14ebb3bc15e3ed677807bce3dc96b1229 Mon Sep 17 00:00:00 2001 From: dotta Date: Wed, 8 Apr 2026 06:11:34 -0500 Subject: [PATCH] fix(ui): avoid issue detail ref update loops --- ui/src/components/MarkdownEditor.tsx | 12 +----------- ui/src/components/ui/button.tsx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ui/src/components/MarkdownEditor.tsx b/ui/src/components/MarkdownEditor.tsx index e8c8838b..0151400f 100644 --- a/ui/src/components/MarkdownEditor.tsx +++ b/ui/src/components/MarkdownEditor.tsx @@ -379,16 +379,6 @@ export const MarkdownEditor = forwardRef return mentions.filter((m) => m.name.toLowerCase().includes(q)).slice(0, 8); }, [mentionState, mentions, slashCommands]); - const setEditorRef = useCallback((instance: MDXEditorMethods | null) => { - ref.current = instance; - if (instance) { - const v = valueRef.current; - echoIgnoreMarkdownRef.current = v; - instance.setMarkdown(v); - latestValueRef.current = v; - } - }, []); - useImperativeHandle(forwardedRef, () => ({ focus: () => { ref.current?.focus(undefined, { defaultSelection: "rootEnd" }); @@ -808,7 +798,7 @@ export const MarkdownEditor = forwardRef onPasteCapture={handlePasteCapture} > { diff --git a/ui/src/components/ui/button.tsx b/ui/src/components/ui/button.tsx index e9933291..fb4efaee 100644 --- a/ui/src/components/ui/button.tsx +++ b/ui/src/components/ui/button.tsx @@ -38,20 +38,24 @@ const buttonVariants = cva( } ) -function Button({ +const Button = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> & + VariantProps & { + asChild?: boolean + } +>(function Button({ className, variant = "default", size = "default", asChild = false, ...props -}: React.ComponentProps<"button"> & - VariantProps & { - asChild?: boolean - }) { +}, ref) { const Comp = asChild ? Slot.Root : "button" return ( ) -} +}) + +Button.displayName = "Button" export { Button, buttonVariants }