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

Function pushProvider

packages/react-reconciler/src/ReactFiberNewContext.js:78–122  ·  packages/react-reconciler/src/ReactFiberNewContext.js::pushProvider
(
  providerFiber: Fiber,
  context: ReactContext<T>,
  nextValue: T,
)

Source from the content-addressed store, hash-verified

76}
77
78export function pushProvider<T>(
79 providerFiber: Fiber,
80 context: ReactContext<T>,
81 nextValue: T,
82): void {
83 if (isPrimaryRenderer) {
84 push(valueCursor, context._currentValue, providerFiber);
85
86 context._currentValue = nextValue;
87 if (__DEV__) {
88 push(rendererCursorDEV, context._currentRenderer, providerFiber);
89
90 if (
91 context._currentRenderer !== undefined &&
92 context._currentRenderer !== null &&
93 context._currentRenderer !== rendererSigil
94 ) {
95 console.error(
96 class="st">'Detected multiple renderers concurrently rendering the ' +
97 class="st">'same context provider. This is currently unsupported.',
98 );
99 }
100 context._currentRenderer = rendererSigil;
101 }
102 } else {
103 push(valueCursor, context._currentValue2, providerFiber);
104
105 context._currentValue2 = nextValue;
106 if (__DEV__) {
107 push(renderer2CursorDEV, context._currentRenderer2, providerFiber);
108
109 if (
110 context._currentRenderer2 !== undefined &&
111 context._currentRenderer2 !== null &&
112 context._currentRenderer2 !== rendererSigil
113 ) {
114 console.error(
115 class="st">'Detected multiple renderers concurrently rendering the ' +
116 class="st">'same context provider. This is currently unsupported.',
117 );
118 }
119 context._currentRenderer2 = rendererSigil;
120 }
121 }
122}
123
124export function popProvider(
125 context: ReactContext<any>,

Callers 3

updateContextProviderFunction · 0.90
pushCacheProviderFunction · 0.90

Calls 2

pushFunction · 0.90
errorMethod · 0.65

Tested by

no test coverage detected