fix(editor/footer): delay the import of Monaco's MarkerSeverity until window is defined

This commit is contained in:
cfngc4594 2025-04-07 12:05:17 +08:00
parent 3e5e2d2a62
commit a7419fe1ba

View File

@ -2,7 +2,6 @@
import { cn } from "@/lib/utils";
import { useEffect, useState } from "react";
import { MarkerSeverity } from "monaco-editor";
import { useProblem } from "@/hooks/use-problem";
import { CircleXIcon, TriangleAlertIcon } from "lucide-react";
@ -10,6 +9,13 @@ interface WorkspaceEditorFooterProps {
className?: string;
}
let MarkerSeverity: typeof import("monaco-editor").MarkerSeverity;
if (typeof window !== "undefined") {
import("monaco-editor").then((monaco) => {
MarkerSeverity = monaco.MarkerSeverity;
});
}
export function WorkspaceEditorFooter({
className,
...props