fix(extensions): wait for runtime hydration before mcp diagnostics
This commit is contained in:
parent
f8c11af5b9
commit
b0c4319ba3
2 changed files with 42 additions and 1 deletions
|
|
@ -151,6 +151,10 @@ export const McpServersPanel = ({
|
||||||
return 'Checking runtime status...';
|
return 'Checking runtime status...';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cliStatus === null || typeof cliStatus === 'undefined') {
|
||||||
|
return 'Checking runtime availability...';
|
||||||
|
}
|
||||||
|
|
||||||
if (cliStatus?.installed === false) {
|
if (cliStatus?.installed === false) {
|
||||||
if (cliStatus.binaryPath && cliStatus.launchError) {
|
if (cliStatus.binaryPath && cliStatus.launchError) {
|
||||||
return 'The configured runtime was found but failed to start. Open the Dashboard to repair or reinstall it.';
|
return 'The configured runtime was found but failed to start. Open the Dashboard to repair or reinstall it.';
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,12 @@ describe('McpServersPanel initial browse loading', () => {
|
||||||
storeState.mcpDiagnosticsLastCheckedAtByProjectPath = undefined;
|
storeState.mcpDiagnosticsLastCheckedAtByProjectPath = undefined;
|
||||||
storeState.runMcpDiagnostics = vi.fn();
|
storeState.runMcpDiagnostics = vi.fn();
|
||||||
storeState.cliStatusLoading = false;
|
storeState.cliStatusLoading = false;
|
||||||
storeState.cliStatus = undefined;
|
storeState.cliStatus = {
|
||||||
|
flavor: 'claude',
|
||||||
|
installed: true,
|
||||||
|
binaryPath: '/usr/local/bin/claude',
|
||||||
|
launchError: null,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|
@ -359,6 +364,38 @@ describe('McpServersPanel initial browse loading', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('waits for runtime hydration before auto-running diagnostics', async () => {
|
||||||
|
storeState.cliStatus = null;
|
||||||
|
|
||||||
|
const host = document.createElement('div');
|
||||||
|
document.body.appendChild(host);
|
||||||
|
const root = createRoot(host);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.render(
|
||||||
|
React.createElement(McpServersPanel, {
|
||||||
|
projectPath: null,
|
||||||
|
mcpSearchQuery: '',
|
||||||
|
mcpSearch: vi.fn(),
|
||||||
|
mcpSearchResults: [],
|
||||||
|
mcpSearchLoading: false,
|
||||||
|
mcpSearchWarnings: [],
|
||||||
|
selectedMcpServerId: null,
|
||||||
|
setSelectedMcpServerId: vi.fn(),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(storeState.runMcpDiagnostics).not.toHaveBeenCalled();
|
||||||
|
expect(host.textContent).toContain('Checking runtime availability...');
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.unmount();
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('renders provider-neutral waiting copy while diagnostics are still running', async () => {
|
it('renders provider-neutral waiting copy while diagnostics are still running', async () => {
|
||||||
storeState.mcpDiagnosticsLoading = true;
|
storeState.mcpDiagnosticsLoading = true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue