MCPcopy Create free account
hub / github.com/microsoft/SandDance / getParentSuspenseInstance

Function getParentSuspenseInstance

docs/external/js/react-dom.development.js:7851–7877  ·  view source on GitHub ↗
(targetInstance)

Source from the content-addressed store, hash-verified

7849 // SUSPENSE_x_START_DATA. Otherwise, null.
7850
7851 function getParentSuspenseInstance(targetInstance) {
7852 var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary.
7853 // There might be nested nodes so we need to keep track of how
7854 // deep we are and only break out when we're back on top.
7855
7856 var depth = 0;
7857
7858 while (node) {
7859 if (node.nodeType === COMMENT_NODE) {
7860 var data = node.data;
7861
7862 if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
7863 if (depth === 0) {
7864 return node;
7865 } else {
7866 depth--;
7867 }
7868 } else if (data === SUSPENSE_END_DATA) {
7869 depth++;
7870 }
7871 }
7872
7873 node = node.previousSibling;
7874 }
7875
7876 return null;
7877 }
7878 function commitHydratedContainer(container) {
7879 // Retry if any event replaying was blocked on this.
7880 retryIfBlockedOn(container);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected