MCPcopy Index your code
hub / github.com/caseywebdev/react-list / getResource

Function getResource

docs/index.js:17316–17424  ·  view source on GitHub ↗
(type, currentProps, pendingProps, currentResource)

Source from the content-addressed store, hash-verified

17314 }
17315}
17316function getResource(type, currentProps, pendingProps, currentResource) {
17317 var JSCompiler_inline_result = (JSCompiler_inline_result =
17318 rootInstanceStackCursor.current)
17319 ? getHoistableRoot(JSCompiler_inline_result)
17320 : null;
17321 if (!JSCompiler_inline_result) throw Error(formatProdErrorMessage(446));
17322 switch (type) {
17323 case "meta":
17324 case "title":
17325 return null;
17326 case "style":
17327 return "string" === typeof pendingProps.precedence &&
17328 "string" === typeof pendingProps.href
17329 ? ((currentProps = getStyleKey(pendingProps.href)),
17330 (pendingProps = getResourcesFromRoot(
17331 JSCompiler_inline_result
17332 ).hoistableStyles),
17333 (currentResource = pendingProps.get(currentProps)),
17334 currentResource ||
17335 ((currentResource = {
17336 type: "style",
17337 instance: null,
17338 count: 0,
17339 state: null
17340 }),
17341 pendingProps.set(currentProps, currentResource)),
17342 currentResource)
17343 : { type: "void", instance: null, count: 0, state: null };
17344 case "link":
17345 if (
17346 "stylesheet" === pendingProps.rel &&
17347 "string" === typeof pendingProps.href &&
17348 "string" === typeof pendingProps.precedence
17349 ) {
17350 type = getStyleKey(pendingProps.href);
17351 var styles$242 = getResourcesFromRoot(
17352 JSCompiler_inline_result
17353 ).hoistableStyles,
17354 resource$243 = styles$242.get(type);
17355 resource$243 ||
17356 ((JSCompiler_inline_result =
17357 JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result),
17358 (resource$243 = {
17359 type: "stylesheet",
17360 instance: null,
17361 count: 0,
17362 state: { loading: 0, preload: null }
17363 }),
17364 styles$242.set(type, resource$243),
17365 (styles$242 = JSCompiler_inline_result.querySelector(
17366 getStylesheetSelectorFromKey(type)
17367 )) &&
17368 !styles$242._p &&
17369 ((resource$243.instance = styles$242),
17370 (resource$243.state.loading = 5)),
17371 preloadPropsMap.has(type) ||
17372 ((pendingProps = {
17373 rel: "preload",

Callers 1

beginWorkFunction · 0.85

Calls 8

getHoistableRootFunction · 0.85
formatProdErrorMessageFunction · 0.85
getStyleKeyFunction · 0.85
getResourcesFromRootFunction · 0.85
preloadStylesheetFunction · 0.85
getScriptKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…