Skip to content

Commit 58b39c6

Browse files
author
Brian Vaughn
committed
Fixed web extensions
1 parent 30b8ef3 commit 58b39c6

File tree

5 files changed

+53
-35
lines changed

5 files changed

+53
-35
lines changed

packages/react-devtools-extensions/src/main.js

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -227,47 +227,57 @@ function createPanelIfReactLoaded() {
227227
let currentPanel = null;
228228
let needsToSyncElementSelection = false;
229229

230-
chrome.devtools.panels.create('⚛ Components', '', 'panel.html', panel => {
231-
panel.onShown.addListener(() => {
232-
if (needsToSyncElementSelection) {
233-
needsToSyncElementSelection = false;
234-
bridge.send('syncSelectionFromNativeElementsPanel');
235-
}
230+
chrome.devtools.panels.create(
231+
'⚛ Components',
232+
'',
233+
'panel.html',
234+
extensionPanel => {
235+
extensionPanel.onShown.addListener(panel => {
236+
if (needsToSyncElementSelection) {
237+
needsToSyncElementSelection = false;
238+
bridge.send('syncSelectionFromNativeElementsPanel');
239+
}
236240

237-
if (currentPanel === panel) {
238-
return;
239-
}
241+
if (currentPanel === panel) {
242+
return;
243+
}
240244

241-
currentPanel = panel;
242-
componentsPortalContainer = panel.container;
245+
currentPanel = panel;
246+
componentsPortalContainer = panel.container;
243247

244-
if (componentsPortalContainer != null) {
245-
ensureInitialHTMLIsCleared(componentsPortalContainer);
246-
render('components');
247-
panel.injectStyles(cloneStyleTags);
248-
}
249-
});
250-
panel.onHidden.addListener(() => {
251-
// TODO: Stop highlighting and stuff.
252-
});
253-
});
248+
if (componentsPortalContainer != null) {
249+
ensureInitialHTMLIsCleared(componentsPortalContainer);
250+
render('components');
251+
panel.injectStyles(cloneStyleTags);
252+
}
253+
});
254+
extensionPanel.onHidden.addListener(panel => {
255+
// TODO: Stop highlighting and stuff.
256+
});
257+
},
258+
);
254259

255-
chrome.devtools.panels.create('⚛ Profiler', '', 'panel.html', panel => {
256-
panel.onShown.addListener(() => {
257-
if (currentPanel === panel) {
258-
return;
259-
}
260+
chrome.devtools.panels.create(
261+
'⚛ Profiler',
262+
'',
263+
'panel.html',
264+
extensionPanel => {
265+
extensionPanel.onShown.addListener(panel => {
266+
if (currentPanel === panel) {
267+
return;
268+
}
260269

261-
currentPanel = panel;
262-
profilerPortalContainer = panel.container;
270+
currentPanel = panel;
271+
profilerPortalContainer = panel.container;
263272

264-
if (profilerPortalContainer != null) {
265-
ensureInitialHTMLIsCleared(profilerPortalContainer);
266-
render('profiler');
267-
panel.injectStyles(cloneStyleTags);
268-
}
269-
});
270-
});
273+
if (profilerPortalContainer != null) {
274+
ensureInitialHTMLIsCleared(profilerPortalContainer);
275+
render('profiler');
276+
panel.injectStyles(cloneStyleTags);
277+
}
278+
});
279+
},
280+
);
271281

272282
chrome.devtools.network.onNavigated.removeListener(checkPageForReact);
273283

packages/react-devtools-extensions/webpack.backend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ module.exports = {
3030
resolve: {
3131
alias: {
3232
react: resolve(builtModulesDir, 'react'),
33+
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
3334
'react-dom': resolve(builtModulesDir, 'react-dom'),
35+
'react-is': resolve(builtModulesDir, 'react-is'),
3436
scheduler: resolve(builtModulesDir, 'scheduler'),
3537
},
3638
},

packages/react-devtools-extensions/webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ module.exports = {
3535
resolve: {
3636
alias: {
3737
react: resolve(builtModulesDir, 'react'),
38+
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
3839
'react-dom': resolve(builtModulesDir, 'react-dom'),
40+
'react-is': resolve(builtModulesDir, 'react-is'),
3941
scheduler: resolve(builtModulesDir, 'scheduler'),
4042
},
4143
},

packages/react-devtools-inline/webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ module.exports = {
3131
},
3232
externals: {
3333
react: 'react',
34+
'react-debug-tools': 'react-debug-tools',
3435
'react-dom': 'react-dom',
36+
'react-is': 'react-is',
3537
scheduler: 'scheduler',
3638
},
3739
plugins: [

packages/react-devtools-shell/webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const config = {
3535
alias: {
3636
react: resolve(builtModulesDir, 'react'),
3737
'react-dom': resolve(builtModulesDir, 'react-dom'),
38+
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
39+
'react-is': resolve(builtModulesDir, 'react-is'),
3840
scheduler: resolve(builtModulesDir, 'scheduler'),
3941
},
4042
},

0 commit comments

Comments
 (0)