fix(editor): stabilize restored tab highlighting#2193
Conversation
Greptile SummaryThis PR stabilizes tab highlighting and header updates during file loading by moving
Confidence Score: 5/5Safe to merge. The changes are well-scoped: UI state is applied eagerly before the editor swap, the loading placeholder now carries all required compartments, and the language-extension lifecycle is guarded against stale async dispatches. No wrong-state dispatches, data loss, or broken contracts were found. The refactored helpers correctly guard async language resolves with both an activeFile id check and a signature check. The new showLoadingEditor state includes all compartments that settings-update handlers reconfigure, so no missing-compartment throws can occur during a session-restore window. No files require special attention. The minor edge case around switch-back-during-load in editorManager.js self-heals via the file-loaded event. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant EditorFile
participant switchFile
participant Editor
User->>EditorFile: click tab (file not loaded)
EditorFile->>switchFile: switchFile(id)
switchFile->>switchFile: file.tab.classList.add("active")
switchFile->>switchFile: "$header.text = file.filename"
switchFile->>Editor: showLoadingEditor(file)
switchFile-->>EditorFile: return
EditorFile->>EditorFile: "#loadText() → file.loading=true"
EditorFile->>EditorFile: await readFile / cache
EditorFile->>EditorFile: "file.session = EditorState({doc:value})"
EditorFile->>switchFile: emit("file-loaded", file)
switchFile->>Editor: applyFileToEditor(file)
Editor->>Editor: resolveLanguageExtension (sync or async)
Note over Editor: async path guarded by activeFile.id check
Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile |
No description provided.