Skip to content

Commit cf76ab7

Browse files
committed
Fix removing the instance from devpanel
1 parent c0f00d6 commit cf76ab7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/app/middlewares/api.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { getReport } from '../../browser/extension/background/logging';
66

77
const CONNECTED = 'socket/CONNECTED';
88
const DISCONNECTED = 'socket/DISCONNECTED';
9-
const naMessage = { type: 'NA' };
109
const connections = {
1110
tab: {},
1211
panel: {},
@@ -116,7 +115,7 @@ function disconnect(type, id, listener) {
116115
return function disconnectListener() {
117116
if (type === 'tab') {
118117
window.store.dispatch({ type: REMOVE_INSTANCE, id });
119-
toMonitors(naMessage);
118+
toMonitors({ type: 'NA', id });
120119
} else {
121120
monitors--;
122121
if (!monitors) monitorInstances(false);

src/browser/extension/devpanel/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { render, unmountComponentAtNode } from 'react-dom';
33
import { Provider } from 'react-redux';
4+
import { REMOVE_INSTANCE } from 'remotedev-app/lib/constants/actionTypes';
45
import App from '../../../app/containers/App';
56
import configureStore from '../../../app/stores/panelStore';
67
import getPreloadedState from '../background/getPreloadedState';
@@ -31,12 +32,15 @@ function renderNA() {
3132
if (rendered === false) return;
3233
rendered = false;
3334
naTimeout = setTimeout(() => {
35+
const node = document.getElementById('root');
36+
unmountComponentAtNode(node);
3437
render(
3538
<div style={{ padding: '20px', width: '100%', textAlign: 'center' }}>
3639
No store found. Make sure to follow <a href="https://github.com/zalmoxisus/redux-devtools-extension#usage" target="_blank">the instructions</a>.
3740
</div>,
38-
document.getElementById('root')
41+
node
3942
);
43+
store = undefined;
4044
}, 1500);
4145
}
4246

@@ -45,7 +49,8 @@ function init(id) {
4549
bgConnection = chrome.runtime.connect({ name: id.toString() });
4650
bgConnection.onMessage.addListener(message => {
4751
if (message.type === 'NA') {
48-
renderNA();
52+
if (message.id === id) renderNA();
53+
else store.dispatch({ type: REMOVE_INSTANCE, id: message.id });
4954
} else {
5055
if (!rendered) renderDevTools();
5156
store.dispatch(message);

0 commit comments

Comments
 (0)