Fixed a tab restoration bug in browser extension
Brian Vaughn committed
Mar 26, 2019 at 11:13 UTC
894990919cafc8c69dfbf9bbdbc9e03728557638
1 file changed
+20
shells/browser/shared/src/main.js
+20
@@ -110,9 +110,17 @@ function createPanelIfReactLoaded() {
110
111
initBridgeAndStore();
112
113
+ let currentPanel = null;
114
+
115
chrome.devtools.panels.create('⚛ Elements', '', 'panel.html', panel => {
116
panel.onShown.addListener(panel => {
117
+ if (currentPanel === panel) {
118
+ return;
119
+ }
120
+
121
+ currentPanel = panel;
122
elementsPortalContainer = panel.container;
123
+
124
if (elementsPortalContainer != null) {
125
elementsPortalContainer.innerHTML = '';
126
render('elements');
@@ -128,7 +136,13 @@ function createPanelIfReactLoaded() {
136
137
chrome.devtools.panels.create('⚛ Profiler', '', 'panel.html', panel => {
138
panel.onShown.addListener(panel => {
139
+ if (currentPanel === panel) {
140
+ return;
141
+ }
142
+
143
+ currentPanel = panel;
144
profilerPortalContainer = panel.container;
145
+
146
if (profilerPortalContainer != null) {
147
profilerPortalContainer.innerHTML = '';
148
render('profiler');
@@ -139,7 +153,13 @@ function createPanelIfReactLoaded() {
153
154
chrome.devtools.panels.create('⚛ Settings', '', 'panel.html', panel => {
155
panel.onShown.addListener(panel => {
156
+ if (currentPanel === panel) {
157
+ return;
158
+ }
159
+
160
+ currentPanel = panel;
161
settingsPortalContainer = panel.container;
162
+
163
if (settingsPortalContainer != null) {
164
settingsPortalContainer.innerHTML = '';
165
render('settings');