Skip to content

Commit 9bed151

Browse files
committed
fixed bug when tab id is stored as a string
1 parent a9736f6 commit 9bed151

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/app/reducers/mainReducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default function mainReducer(state, action) {
130130
});
131131

132132
// only set first tab if current tab is non existent
133-
const firstTab = Object.keys(payload)[0];
133+
const firstTab = parseInt(Object.keys(payload)[0], 10);
134134
return {
135135
...state,
136136
currentTab: (currentTab === null) ? firstTab : currentTab,

src/extension/background.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ function createTabObj() {
1616
chrome.runtime.onConnect.addListener((port) => {
1717
bg = port;
1818

19-
// if snapshots were saved in the snapshots,
2019
// send it to devtools as soon as connection to devtools is made
21-
if (Object.values(tabsObj)[0].snapshots.length > 0) {
20+
if (Object.keys(tabsObj).length > 0) {
2221
bg.postMessage({
2322
action: 'initialConnectSnapshots',
2423
payload: tabsObj,
@@ -55,12 +54,7 @@ chrome.runtime.onConnect.addListener((port) => {
5554
default:
5655
}
5756

58-
// Instead of sending the message to the active tab,
59-
// now we can send messages to specific tabs that we specify
60-
// using tabId
61-
// ---------------------------------------------------------------
6257
chrome.tabs.sendMessage(tabId, msg);
63-
// ---------------------------------------------------------------
6458
});
6559
});
6660

0 commit comments

Comments
 (0)