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

Function ReactFiberHydrationContext

code/communication/public/app.js:12005–12298  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

12003};
12004
12005var ReactFiberHydrationContext = function (config) {
12006 var shouldSetTextContent = config.shouldSetTextContent,
12007 hydration = config.hydration;
12008
12009 // If this doesn't have hydration mode.
12010
12011 if (!hydration) {
12012 return {
12013 enterHydrationState: function () {
12014 return false;
12015 },
12016 resetHydrationState: function () {},
12017 tryToClaimNextHydratableInstance: function () {},
12018 prepareToHydrateHostInstance: function () {
12019 invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
12020 },
12021 prepareToHydrateHostTextInstance: function () {
12022 invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
12023 },
12024 popHydrationState: function (fiber) {
12025 return false;
12026 }
12027 };
12028 }
12029
12030 var canHydrateInstance = hydration.canHydrateInstance,
12031 canHydrateTextInstance = hydration.canHydrateTextInstance,
12032 getNextHydratableSibling = hydration.getNextHydratableSibling,
12033 getFirstHydratableChild = hydration.getFirstHydratableChild,
12034 hydrateInstance = hydration.hydrateInstance,
12035 hydrateTextInstance = hydration.hydrateTextInstance,
12036 didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance,
12037 didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance,
12038 didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance,
12039 didNotHydrateInstance = hydration.didNotHydrateInstance,
12040 didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance,
12041 didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance,
12042 didNotFindHydratableInstance = hydration.didNotFindHydratableInstance,
12043 didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance;
12044
12045 // The deepest Fiber on the stack involved in a hydration context.
12046 // This may have been an insertion or a hydration.
12047
12048 var hydrationParentFiber = null;
12049 var nextHydratableInstance = null;
12050 var isHydrating = false;
12051
12052 function enterHydrationState(fiber) {
12053 var parentInstance = fiber.stateNode.containerInfo;
12054 nextHydratableInstance = getFirstHydratableChild(parentInstance);
12055 hydrationParentFiber = fiber;
12056 isHydrating = true;
12057 return true;
12058 }
12059
12060 function deleteHydratableInstance(returnFiber, instance) {
12061 {
12062 switch (returnFiber.tag) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected