Skip to content

Commit cde8dbd

Browse files
committed
Avoid auto selecting instance in iFrame
Avoid auto selecting the outter frame instance when redux exist in iFrame embedded on the page.
1 parent 6512665 commit cde8dbd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

extension/src/window/store/instanceSelectorMiddleware.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ function selectInstance(
1313
) {
1414
const instances = store.getState().instances;
1515
if (instances.current === 'default') return;
16-
const connections = instances.connections[tabId];
16+
17+
const connections = Object.entries(instances.connections).reduce<
18+
(string | number)[]
19+
>((acc, [key, connections]) => {
20+
if (key.startsWith(String(tabId))) {
21+
return [...acc, ...connections];
22+
}
23+
return acc;
24+
}, []);
25+
1726
if (connections && connections.length === 1) {
1827
next({ type: SELECT_INSTANCE, selected: connections[0] });
1928
}

0 commit comments

Comments
 (0)