Skip to content

Commit

Permalink
Avoid auto selecting instance in iFrame
Browse files Browse the repository at this point in the history
Avoid auto selecting the outter frame instance when redux exist in
iFrame embedded on the page.
  • Loading branch information
alexandcote committed Jun 21, 2024
1 parent 6512665 commit cde8dbd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion extension/src/window/store/instanceSelectorMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ function selectInstance(
) {
const instances = store.getState().instances;
if (instances.current === 'default') return;
const connections = instances.connections[tabId];

const connections = Object.entries(instances.connections).reduce<
(string | number)[]
>((acc, [key, connections]) => {
if (key.startsWith(String(tabId))) {
return [...acc, ...connections];
}
return acc;
}, []);

if (connections && connections.length === 1) {
next({ type: SELECT_INSTANCE, selected: connections[0] });
}
Expand Down

0 comments on commit cde8dbd

Please sign in to comment.