chore(extension): terminate connection if nothing has been selected (#827)

This commit is contained in:
Yury Semikhatsky
2025-08-05 09:47:39 -07:00
committed by GitHub
parent 4890b9d509
commit 46ce86f97e
3 changed files with 99 additions and 22 deletions

View File

@@ -61,9 +61,16 @@ const ConnectApp: React.FC = () => {
return;
}
void connectToMCPRelay(relayUrl);
void loadTabs();
}, []);
const connectToMCPRelay = useCallback(async (mcpRelayUrl: string) => {
const response = await chrome.runtime.sendMessage({ type: 'connectToMCPRelay', mcpRelayUrl });
if (!response.success)
setStatus({ type: 'error', message: 'Failed to connect to MCP relay: ' + response.error });
}, []);
const loadTabs = useCallback(async () => {
const response = await chrome.runtime.sendMessage({ type: 'getTabs' });
if (response.success) {
@@ -86,7 +93,7 @@ const ConnectApp: React.FC = () => {
try {
const response = await chrome.runtime.sendMessage({
type: 'connectToMCPRelay',
type: 'connectToTab',
mcpRelayUrl,
tabId: selectedTab.id,
windowId: selectedTab.windowId,