Skip to content

Commit

Permalink
Defer unmount() calls in autocomplete/tooltips to fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Sep 16, 2024
1 parent d61857a commit 76d122c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/latest/scripts/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function Editor({ code, ratio, children, setCode, theme, literate
return { dom, top: true };
}), []);

const extensions = [...useMemo(() => EXTENSIONS.concat([literate ? vyxalLit(elementData!) : vyxal(util, elementData!)]), [literate]), header];
const extensions = useMemo(() => EXTENSIONS.concat(literate ? vyxalLit(elementData!) : vyxal(util, elementData!), header), [literate]);
return <div style={{ height: ratio, overflow: "auto", position: "relative" }}>
<ErrorBoundary FallbackComponent={EditorError}>
<ReactCodeMirror
Expand Down
4 changes: 2 additions & 2 deletions src/latest/scripts/extensions/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function elementCompletion(thing: SyntaxThing, literate: boolean): Completion {
return {
dom: container,
destroy() {
root.unmount();
setTimeout(() => root.unmount());
},
};
},
Expand Down Expand Up @@ -88,7 +88,7 @@ export function elementTooltip(elementData: ElementData, literate: boolean) {
return {
dom: container,
destroy() {
root.unmount();
setTimeout(() => root.unmount());
},
};
},
Expand Down

0 comments on commit 76d122c

Please sign in to comment.