Skip to content

Commit

Permalink
Fixed web extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 14, 2019
1 parent 30b8ef3 commit 58b39c6
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 35 deletions.
80 changes: 45 additions & 35 deletions packages/react-devtools-extensions/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,47 +227,57 @@ function createPanelIfReactLoaded() {
let currentPanel = null;
let needsToSyncElementSelection = false;

chrome.devtools.panels.create('⚛ Components', '', 'panel.html', panel => {
panel.onShown.addListener(() => {
if (needsToSyncElementSelection) {
needsToSyncElementSelection = false;
bridge.send('syncSelectionFromNativeElementsPanel');
}
chrome.devtools.panels.create(
'⚛ Components',
'',
'panel.html',
extensionPanel => {
extensionPanel.onShown.addListener(panel => {
if (needsToSyncElementSelection) {
needsToSyncElementSelection = false;
bridge.send('syncSelectionFromNativeElementsPanel');
}

if (currentPanel === panel) {
return;
}
if (currentPanel === panel) {
return;
}

currentPanel = panel;
componentsPortalContainer = panel.container;
currentPanel = panel;
componentsPortalContainer = panel.container;

if (componentsPortalContainer != null) {
ensureInitialHTMLIsCleared(componentsPortalContainer);
render('components');
panel.injectStyles(cloneStyleTags);
}
});
panel.onHidden.addListener(() => {
// TODO: Stop highlighting and stuff.
});
});
if (componentsPortalContainer != null) {
ensureInitialHTMLIsCleared(componentsPortalContainer);
render('components');
panel.injectStyles(cloneStyleTags);
}
});
extensionPanel.onHidden.addListener(panel => {
// TODO: Stop highlighting and stuff.
});
},
);

chrome.devtools.panels.create('⚛ Profiler', '', 'panel.html', panel => {
panel.onShown.addListener(() => {
if (currentPanel === panel) {
return;
}
chrome.devtools.panels.create(
'⚛ Profiler',
'',
'panel.html',
extensionPanel => {
extensionPanel.onShown.addListener(panel => {
if (currentPanel === panel) {
return;
}

currentPanel = panel;
profilerPortalContainer = panel.container;
currentPanel = panel;
profilerPortalContainer = panel.container;

if (profilerPortalContainer != null) {
ensureInitialHTMLIsCleared(profilerPortalContainer);
render('profiler');
panel.injectStyles(cloneStyleTags);
}
});
});
if (profilerPortalContainer != null) {
ensureInitialHTMLIsCleared(profilerPortalContainer);
render('profiler');
panel.injectStyles(cloneStyleTags);
}
});
},
);

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

Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-extensions/webpack.backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ module.exports = {
resolve: {
alias: {
react: resolve(builtModulesDir, 'react'),
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
'react-dom': resolve(builtModulesDir, 'react-dom'),
'react-is': resolve(builtModulesDir, 'react-is'),
scheduler: resolve(builtModulesDir, 'scheduler'),
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-extensions/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ module.exports = {
resolve: {
alias: {
react: resolve(builtModulesDir, 'react'),
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
'react-dom': resolve(builtModulesDir, 'react-dom'),
'react-is': resolve(builtModulesDir, 'react-is'),
scheduler: resolve(builtModulesDir, 'scheduler'),
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-inline/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ module.exports = {
},
externals: {
react: 'react',
'react-debug-tools': 'react-debug-tools',
'react-dom': 'react-dom',
'react-is': 'react-is',
scheduler: 'scheduler',
},
plugins: [
Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-shell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const config = {
alias: {
react: resolve(builtModulesDir, 'react'),
'react-dom': resolve(builtModulesDir, 'react-dom'),
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
'react-is': resolve(builtModulesDir, 'react-is'),
scheduler: resolve(builtModulesDir, 'scheduler'),
},
},
Expand Down

0 comments on commit 58b39c6

Please sign in to comment.