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

Function tryHydrate

docs/external/js/react-dom.development.js:16661–16699  ·  view source on GitHub ↗
(fiber, nextInstance)

Source from the content-addressed store, hash-verified

16659 }
16660
16661 function tryHydrate(fiber, nextInstance) {
16662 switch (fiber.tag) {
16663 case HostComponent:
16664 {
16665 var type = fiber.type;
16666 var props = fiber.pendingProps;
16667 var instance = canHydrateInstance(nextInstance, type);
16668
16669 if (instance !== null) {
16670 fiber.stateNode = instance;
16671 return true;
16672 }
16673
16674 return false;
16675 }
16676
16677 case HostText:
16678 {
16679 var text = fiber.pendingProps;
16680 var textInstance = canHydrateTextInstance(nextInstance, text);
16681
16682 if (textInstance !== null) {
16683 fiber.stateNode = textInstance;
16684 return true;
16685 }
16686
16687 return false;
16688 }
16689
16690 case SuspenseComponent:
16691 {
16692
16693 return false;
16694 }
16695
16696 default:
16697 return false;
16698 }
16699 }
16700
16701 function tryToClaimNextHydratableInstance(fiber) {
16702 if (!isHydrating) {

Callers 1

Calls 2

canHydrateInstanceFunction · 0.85
canHydrateTextInstanceFunction · 0.85

Tested by

no test coverage detected