MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / ReactFiberHydrationContext

Function ReactFiberHydrationContext

code/composition/public/app.js:12108–12401  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

12106};
12107
12108var ReactFiberHydrationContext = function (config) {
12109 var shouldSetTextContent = config.shouldSetTextContent,
12110 hydration = config.hydration;
12111
12112 // If this doesn't have hydration mode.
12113
12114 if (!hydration) {
12115 return {
12116 enterHydrationState: function () {
12117 return false;
12118 },
12119 resetHydrationState: function () {},
12120 tryToClaimNextHydratableInstance: function () {},
12121 prepareToHydrateHostInstance: function () {
12122 invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
12123 },
12124 prepareToHydrateHostTextInstance: function () {
12125 invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
12126 },
12127 popHydrationState: function (fiber) {
12128 return false;
12129 }
12130 };
12131 }
12132
12133 var canHydrateInstance = hydration.canHydrateInstance,
12134 canHydrateTextInstance = hydration.canHydrateTextInstance,
12135 getNextHydratableSibling = hydration.getNextHydratableSibling,
12136 getFirstHydratableChild = hydration.getFirstHydratableChild,
12137 hydrateInstance = hydration.hydrateInstance,
12138 hydrateTextInstance = hydration.hydrateTextInstance,
12139 didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance,
12140 didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance,
12141 didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance,
12142 didNotHydrateInstance = hydration.didNotHydrateInstance,
12143 didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance,
12144 didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance,
12145 didNotFindHydratableInstance = hydration.didNotFindHydratableInstance,
12146 didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance;
12147
12148 // The deepest Fiber on the stack involved in a hydration context.
12149 // This may have been an insertion or a hydration.
12150
12151 var hydrationParentFiber = null;
12152 var nextHydratableInstance = null;
12153 var isHydrating = false;
12154
12155 function enterHydrationState(fiber) {
12156 var parentInstance = fiber.stateNode.containerInfo;
12157 nextHydratableInstance = getFirstHydratableChild(parentInstance);
12158 hydrationParentFiber = fiber;
12159 isHydrating = true;
12160 return true;
12161 }
12162
12163 function deleteHydratableInstance(returnFiber, instance) {
12164 {
12165 switch (returnFiber.tag) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected