mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
fix(coding-agent): restore the correct editor after /reload (#949)
This issue occurs when extension uses setEditorComponent. The restoreEditor() callback was capturing this.editor AFTER resetExtensionUI() (which restores defaultEditor), then adding that captured editor back to the container - ignoring any new editor created by extensions during session_start. On success, use this.editor (may be custom editor from extension). On failure, restore the fallback editor (safe defaultEditor state). Rename restoreEditor to dismissLoader to reflect its actual purpose.
This commit is contained in:
parent
225fcb3830
commit
27b27d9441
1 changed files with 5 additions and 5 deletions
|
|
@ -3659,11 +3659,11 @@ export class InteractiveMode {
|
|||
this.ui.setFocus(loader);
|
||||
this.ui.requestRender();
|
||||
|
||||
const restoreEditor = () => {
|
||||
const dismissLoader = (editor: Component) => {
|
||||
loader.dispose();
|
||||
this.editorContainer.clear();
|
||||
this.editorContainer.addChild(previousEditor);
|
||||
this.ui.setFocus(previousEditor as Component);
|
||||
this.editorContainer.addChild(editor);
|
||||
this.ui.setFocus(editor);
|
||||
this.ui.requestRender();
|
||||
};
|
||||
|
||||
|
|
@ -3676,7 +3676,7 @@ export class InteractiveMode {
|
|||
this.setupExtensionShortcuts(runner);
|
||||
}
|
||||
this.rebuildChatFromMessages();
|
||||
restoreEditor();
|
||||
dismissLoader(this.editor as Component);
|
||||
this.showLoadedResources({ extensionPaths: runner?.getExtensionPaths() ?? [], force: true });
|
||||
const modelsJsonError = this.session.modelRegistry.getError();
|
||||
if (modelsJsonError) {
|
||||
|
|
@ -3684,7 +3684,7 @@ export class InteractiveMode {
|
|||
}
|
||||
this.showStatus("Reloaded extensions, skills, prompts, themes");
|
||||
} catch (error) {
|
||||
restoreEditor();
|
||||
dismissLoader(previousEditor as Component);
|
||||
this.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue