fix(extensions): wait for runtime hydration before mcp diagnostics

This commit is contained in:
777genius 2026-04-17 21:05:27 +03:00
parent f8c11af5b9
commit b0c4319ba3
2 changed files with 42 additions and 1 deletions

View file

@ -151,6 +151,10 @@ export const McpServersPanel = ({
return 'Checking runtime status...';
}
if (cliStatus === null || typeof cliStatus === 'undefined') {
return 'Checking runtime availability...';
}
if (cliStatus?.installed === false) {
if (cliStatus.binaryPath && cliStatus.launchError) {
return 'The configured runtime was found but failed to start. Open the Dashboard to repair or reinstall it.';

View file

@ -149,7 +149,12 @@ describe('McpServersPanel initial browse loading', () => {
storeState.mcpDiagnosticsLastCheckedAtByProjectPath = undefined;
storeState.runMcpDiagnostics = vi.fn();
storeState.cliStatusLoading = false;
storeState.cliStatus = undefined;
storeState.cliStatus = {
flavor: 'claude',
installed: true,
binaryPath: '/usr/local/bin/claude',
launchError: null,
};
});
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 () => {
storeState.mcpDiagnosticsLoading = true;