Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/react-devtools-extensions/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,24 @@ function ensureInitialHTMLIsCleared(container) {

function createComponentsPanel() {
if (componentsPortalContainer) {
// Panel is created and user opened it at least once
render('components');

return;
}

if (componentsPanel) {
// Panel is created, but wasn't opened yet, so no document is present for it
return;
}

chrome.devtools.panels.create(
IS_CHROME || IS_EDGE ? '⚛️ Components' : 'Components',
IS_EDGE ? 'icons/production.svg' : '',
'panel.html',
createdPanel => {
componentsPanel = createdPanel;

createdPanel.onShown.addListener(portal => {
componentsPortalContainer = portal.container;
if (componentsPortalContainer != null) {
Expand All @@ -370,16 +378,24 @@ function createComponentsPanel() {

function createProfilerPanel() {
if (profilerPortalContainer) {
// Panel is created and user opened it at least once
render('profiler');

return;
}

if (profilerPanel) {
// Panel is created, but wasn't opened yet, so no document is present for it
return;
}

chrome.devtools.panels.create(
IS_CHROME || IS_EDGE ? '⚛️ Profiler' : 'Profiler',
IS_EDGE ? 'icons/production.svg' : '',
'panel.html',
createdPanel => {
profilerPanel = createdPanel;

createdPanel.onShown.addListener(portal => {
profilerPortalContainer = portal.container;
if (profilerPortalContainer != null) {
Expand Down Expand Up @@ -510,6 +526,8 @@ let store = null;

let profilingData = null;

let componentsPanel = null;
let profilerPanel = null;
let componentsPortalContainer = null;
let profilerPortalContainer = null;

Expand Down