MCPcopy
hub / github.com/facebook/react / createSuspensePanel

Function createSuspensePanel

packages/react-devtools-extensions/src/main/index.js:363–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

361}
362
363function createSuspensePanel() {
364 if (suspensePortalContainer) {
365 // Panel is created and user opened it at least once
366 ensureInitialHTMLIsCleared(suspensePortalContainer);
367 render('suspense');
368
369 return;
370 }
371
372 if (suspensePanel) {
373 // Panel is created, but wasn't opened yet, so no document is present for it
374 return;
375 }
376
377 chrome.devtools.panels.create(
378 __IS_CHROME__ || __IS_EDGE__ ? 'Suspense ⚛' : 'Suspense',
379 __IS_EDGE__ ? 'icons/production.svg' : '',
380 'panel.html',
381 createdPanel => {
382 suspensePanel = createdPanel;
383
384 createdPanel.onShown.addListener(portal => {
385 suspensePortalContainer = portal.container;
386 if (suspensePortalContainer != null && render) {
387 ensureInitialHTMLIsCleared(suspensePortalContainer);
388
389 render('suspense');
390 portal.injectStyles(cloneStyleTags);
391
392 logEvent({event_name: 'selected-suspense-tab'});
393 }
394 });
395 },
396 );
397}
398
399function performInTabNavigationCleanup() {
400 // Potentially, if react hasn't loaded yet and user performs in-tab navigation

Callers 1

createBridgeAndStoreFunction · 0.85

Calls 5

logEventFunction · 0.90
createMethod · 0.65
addListenerMethod · 0.65
renderFunction · 0.50

Tested by

no test coverage detected