Skip to content

Commit 4419a0b

Browse files
committed
Fix sticking instances
1 parent 8a41059 commit 4419a0b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/browser/extension/background/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ const store = createDevStore(toContentScript);
77

88
// Expose objects globally in order to use them from windows via chrome.runtime.getBackgroundPage
99
window.store = store;
10-
window.store.liftedStore.instances = {};
10+
window.store.instances = {};
11+
window.store.setInstance = instance => {
12+
store.instance = instance;
13+
store.liftedStore.setInstance(instance, true);
14+
};
1115

1216
chrome.commands.onCommand.addListener(shortcut => {
1317
openDevToolsWindow(shortcut);

src/browser/extension/background/messaging.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function getId(port) {
2525
function initInstance(msg, port) {
2626
const id = getId(port);
2727
tabConnections[id] = port;
28-
store.liftedStore.instances[id] = msg.instance;
28+
store.instances[id] = msg.instance;
2929
store.id = id;
3030
if (typeof id === 'number') chrome.pageAction.show(id);
3131
if (isMonitored) return { type: 'START' };
@@ -39,8 +39,8 @@ function disconnect(port) {
3939
const id = getId(port);
4040
delete tabConnections[id];
4141
if (panelConnections[id]) panelConnections[id].postMessage(naMessage);
42-
if (window.store.liftedStore.instances[id]) {
43-
delete window.store.liftedStore.instances[id];
42+
if (window.store.instances[id]) {
43+
delete window.store.instances[id];
4444
window.store.liftedStore.deleteInstance(id);
4545
}
4646
}
@@ -52,7 +52,7 @@ onConnect(undefined, {
5252
}, panelConnections, disconnect);
5353

5454
function handleInstancesChanged(instance, name) {
55-
window.store.liftedStore.instances[instance] = name || instance;
55+
window.store.instances[instance] = name || instance;
5656
}
5757

5858
// Receive message from content script
@@ -83,7 +83,7 @@ function messaging(request, sender, sendResponse) {
8383
}
8484

8585
request.id = tabId;
86-
const payload = updateState(store, request, handleInstancesChanged, store.liftedStore.instance);
86+
const payload = updateState(store, request, handleInstancesChanged, store.instance);
8787
if (!payload) return true;
8888

8989
// Relay the message to the devTools panel

0 commit comments

Comments
 (0)