Skip to content

Commit d03eb59

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 d03eb59

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/fluffy-steaks-promise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'remotedev-redux-devtools-extension': patch
3+
---
4+
5+
Avoid auto-selecting instance with iFrames

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)