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

Function ReactFiberHydrationContext

code/styling/public/app.js:11970–12263  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

11968};
11969
11970var ReactFiberHydrationContext = function (config) {
11971 var shouldSetTextContent = config.shouldSetTextContent,
11972 hydration = config.hydration;
11973
11974 // If this doesn't have hydration mode.
11975
11976 if (!hydration) {
11977 return {
11978 enterHydrationState: function () {
11979 return false;
11980 },
11981 resetHydrationState: function () {},
11982 tryToClaimNextHydratableInstance: function () {},
11983 prepareToHydrateHostInstance: function () {
11984 invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
11985 },
11986 prepareToHydrateHostTextInstance: function () {
11987 invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
11988 },
11989 popHydrationState: function (fiber) {
11990 return false;
11991 }
11992 };
11993 }
11994
11995 var canHydrateInstance = hydration.canHydrateInstance,
11996 canHydrateTextInstance = hydration.canHydrateTextInstance,
11997 getNextHydratableSibling = hydration.getNextHydratableSibling,
11998 getFirstHydratableChild = hydration.getFirstHydratableChild,
11999 hydrateInstance = hydration.hydrateInstance,
12000 hydrateTextInstance = hydration.hydrateTextInstance,
12001 didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance,
12002 didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance,
12003 didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance,
12004 didNotHydrateInstance = hydration.didNotHydrateInstance,
12005 didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance,
12006 didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance,
12007 didNotFindHydratableInstance = hydration.didNotFindHydratableInstance,
12008 didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance;
12009
12010 // The deepest Fiber on the stack involved in a hydration context.
12011 // This may have been an insertion or a hydration.
12012
12013 var hydrationParentFiber = null;
12014 var nextHydratableInstance = null;
12015 var isHydrating = false;
12016
12017 function enterHydrationState(fiber) {
12018 var parentInstance = fiber.stateNode.containerInfo;
12019 nextHydratableInstance = getFirstHydratableChild(parentInstance);
12020 hydrationParentFiber = fiber;
12021 isHydrating = true;
12022 return true;
12023 }
12024
12025 function deleteHydratableInstance(returnFiber, instance) {
12026 {
12027 switch (returnFiber.tag) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected