chore(extension): terminate connection if nothing has been selected (#827)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user