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

Function resolveLoadables

packages/react-dom/src/__tests__/ReactDOMFloat-test.js:397–411  ·  view source on GitHub ↗
(hrefs, nodes, event, onLoad)

Source from the content-addressed store, hash-verified

395 }
396
397 function resolveLoadables(hrefs, nodes, event, onLoad) {
398 const hrefSet = hrefs ? new Set(hrefs) : null;
399 for (let i = 0; i < nodes.length; i++) {
400 const node = nodes[i];
401 if (loadCache.has(node)) {
402 continue;
403 }
404 const href = node.getAttribute('href');
405 if (!hrefSet || hrefSet.has(href)) {
406 loadCache.add(node);
407 onLoad(href);
408 node.dispatchEvent(event);
409 }
410 }
411 }
412
413 it('can render resources before singletons', async () => {
414 const root = ReactDOMClient.createRoot(document);

Callers 4

loadPreloadsFunction · 0.85
errorPreloadsFunction · 0.85
loadStylesheetsFromFunction · 0.85
errorStylesheetsFunction · 0.85

Calls 3

onLoadFunction · 0.85
addMethod · 0.80
hasMethod · 0.65

Tested by

no test coverage detected