MCPcopy
hub / github.com/facebook/react / popHostContext

Function popHostContext

packages/react-reconciler/src/ReactFiberHostContext.js:112–139  ·  view source on GitHub ↗
(fiber: Fiber)

Source from the content-addressed store, hash-verified

110}
111
112function popHostContext(fiber: Fiber): void {
113 if (contextFiberStackCursor.current === fiber) {
114 // Do not pop unless this Fiber provided the current context.
115 // pushHostContext() only pushes Fibers that provide unique contexts.
116 pop(contextStackCursor, fiber);
117 pop(contextFiberStackCursor, fiber);
118 }
119
120 if (hostTransitionProviderCursor.current === fiber) {
121 // Do not pop unless this Fiber provided the current context. This is mostly
122 // a performance optimization, but conveniently it also prevents a potential
123 // data race where a host provider is upgraded (i.e. memoizedState becomes
124 // non-null) during a concurrent event. This is a bit of a flaw in the way
125 // we upgrade host components, but because we're accounting for it here, it
126 // should be fine.
127 pop(hostTransitionProviderCursor, fiber);
128
129 // When popping the transition provider, we reset the context value back
130 // to `NotPendingTransition`. We can do this because you're not allowed to nest forms. If
131 // we allowed for multiple nested host transition providers, then we'd
132 // need to reset this to the parent provider's status.
133 if (isPrimaryRenderer) {
134 HostTransitionContext._currentValue = NotPendingTransition;
135 } else {
136 HostTransitionContext._currentValue2 = NotPendingTransition;
137 }
138 }
139}
140
141export {
142 getHostContext,

Callers 3

unwindWorkFunction · 0.90
unwindInterruptedWorkFunction · 0.90
completeWorkFunction · 0.90

Calls 1

popFunction · 0.90

Tested by

no test coverage detected