Open
Conversation
Root cause: Monaco editor had no worker configuration (self.MonacoEnvironment), causing workers to fail silently in Vite/Tauri and the editor to hang during initialization. Changes: - Add MonacoEnvironment.getWorker() config with proper Vite worker URLs using new URL(..., import.meta.url) for all Monaco workers (editor, JSON, CSS, HTML, TypeScript) - Replace static CodeEditor import in MultiBuffer.tsx with lazy() import to prevent pulling all editor dependencies into the initial chunk - Add 15s timeout on Monaco loading to prevent permanent loading spinners - Add retry limit (max 2 attempts) in createEffect to prevent infinite retry loops when Monaco fails to load https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
The infinite loading spinner was caused by Monaco not being in Vite's optimizeDeps.include. Without pre-bundling, Vite serves 500+ individual ESM files on first dynamic import, triggering an on-the-fly re-optimization that blocks the import indefinitely. Changes: - Add "monaco-editor" to optimizeDeps.include in vite.config.ts so Vite pre-bundles it at dev server start instead of on first request - Add ErrorBoundary around LazyEditor's Suspense to catch and display module load failures with a retry button, instead of an infinite spinner https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
ROOT CAUSE: containerRef was a plain `let` variable, not a SolidJS signal. The createEffect that creates the Monaco editor checks: if (!containerRef || isLoading()) return; Since containerRef is not reactive, setting it via the ref callback does NOT trigger the effect to re-run. When Monaco is already cached (isLoading flips to false before the ref callback fires), the effect runs, sees containerRef as undefined, returns early, and NEVER re-runs — causing the infinite "Loading editor..." spinner. Fix: Convert containerRef to createSignal<HTMLDivElement | undefined>() so the createEffect properly tracks it as a dependency and re-runs when the ref callback sets the container element. https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
…llback
The editor container had `height: "auto"` which overrides `flex: 1` on
WebKitGTK (Tauri/Linux), causing Monaco to render into a 0-height div.
Changed to `height: "100%"` so the flex layout properly sizes the container.
Also added try/catch fallback for Monaco web workers: module workers
(`{ type: "module" }`) may not be supported on WebKitGTK, so we now
fall back to classic workers via blob URLs when module workers fail.
https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
Three interacting bugs caused "Loading editor..." to show forever: 1. LazyEditor used lazy()+Suspense for CodeEditor, but on WebKitGTK the dynamic chunk import can silently hang — Suspense has no timeout, so the fallback skeleton shows forever. Fixed by using a direct import. 2. EditorInstance's createEffect retry called monacoManager.ensureLoaded() without a timeout. After the initial 15s timeout in onMount, the retry got back the SAME dead promise (MonacoManager was still in "loading" state), hanging forever. Fixed by adding Promise.race timeout to retry. 3. MonacoManager had no way to reset from a timed-out load — it stayed in "loading" state with a dead promise. Added resetLoadState() method, called on timeout/error to allow fresh retry attempts. https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
Adds console.warn diagnostics at every stage of the editor loading chain to identify the exact stuck point on WebKitGTK: - EditorPanel: logs isOpening, hasOpenFiles, showEditor state changes - openFile: logs IPC call start/completion and isOpening transitions - LazyEditor: logs file activation and wasEverActive state - EditorInstance: logs onMount, Monaco load status, createEffect state - MonacoManager: logs ensureLoaded state machine, import() resolution Also preloads Monaco at EditorProvider startup (Tier 1 mount) so the editor module is already loaded by the time a user opens their first file. This eliminates the 15+ second wait on first file open. https://claude.ai/code/session_015pVrWpDDycPtrZNiJEod36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.