Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(editor): avoid accessing editor.view during initial render in link preview

Jiang Bohan46d745cb60c3
diff --git a/packages/views/editor/link-preview.tsx b/packages/views/editor/link-preview.tsx
index be41cfa468..729f44a728 100644
--- a/packages/views/editor/link-preview.tsx
+++ b/packages/views/editor/link-preview.tsx
@@ -156,9 +156,10 @@ function EditorLinkPreview({ editor }: { editor: Editor }) {
const close = useCallback(() => setVisible(false), []);
+ // Avoid accessing editor.view during initial render — it may not be mounted yet.
const virtualRef = useRef({
getBoundingClientRect: () => new DOMRect(),
- contextElement: editor.view?.dom,
+ contextElement: undefined as Element | undefined,
});
const { refs, floatingStyles, isPositioned, update } = useFloating({