MCPcopy Create free account
hub / github.com/plotly/dash / mountId

Function mountId

dash/deps/react-dom@18.3.1.js:16579–16612  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16577 }
16578
16579 function mountId() {
16580 var hook = mountWorkInProgressHook();
16581 var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we
16582 // should do this in Fiber, too? Deferring this decision for now because
16583 // there's no other place to store the prefix except for an internal field on
16584 // the public createRoot object, which the fiber tree does not currently have
16585 // a reference to.
16586
16587 var identifierPrefix = root.identifierPrefix;
16588 var id;
16589
16590 if (getIsHydrating()) {
16591 var treeId = getTreeId(); // Use a captial R prefix for server-generated ids.
16592
16593 id = ':' + identifierPrefix + 'R' + treeId; // Unless this is the first id at this level, append a number at the end
16594 // that represents the position of this useId hook among all the useId
16595 // hooks for this fiber.
16596
16597 var localId = localIdCounter++;
16598
16599 if (localId > 0) {
16600 id += 'H' + localId.toString(32);
16601 }
16602
16603 id += ':';
16604 } else {
16605 // Use a lowercase r prefix for client-generated ids.
16606 var globalClientId = globalClientIdCounter++;
16607 id = ':' + identifierPrefix + 'r' + globalClientId.toString(32) + ':';
16608 }
16609
16610 hook.memoizedState = id;
16611 return id;
16612 }
16613
16614 function updateId() {
16615 var hook = updateWorkInProgressHook();

Callers 1

Calls 5

mountWorkInProgressHookFunction · 0.70
getWorkInProgressRootFunction · 0.70
getIsHydratingFunction · 0.70
getTreeIdFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…