diff --git a/.changeset/fluffy-steaks-promise.md b/.changeset/fluffy-steaks-promise.md new file mode 100644 index 00000000..7c9d27fa --- /dev/null +++ b/.changeset/fluffy-steaks-promise.md @@ -0,0 +1,5 @@ +--- +'remotedev-redux-devtools-extension': patch +--- + +Avoid auto-selecting instance with iFrames diff --git a/extension/src/window/store/instanceSelectorMiddleware.ts b/extension/src/window/store/instanceSelectorMiddleware.ts index e10879bc..b72b6906 100644 --- a/extension/src/window/store/instanceSelectorMiddleware.ts +++ b/extension/src/window/store/instanceSelectorMiddleware.ts @@ -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] }); }