@@ -49,6 +49,15 @@ import {REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED} from 'shared/ReactSymbols
4949
5050const valueCursor : StackCursor < mixed > = createCursor(null);
5151
52+ let rendererCursorDEV: StackCursor< Object | null > ;
53+ if (__DEV__) {
54+ rendererCursorDEV = createCursor ( null ) ;
55+ }
56+ let renderer2CursorDEV: StackCursor< Object | null > ;
57+ if (__DEV__) {
58+ renderer2CursorDEV = createCursor ( null ) ;
59+ }
60+
5261let rendererSigil;
5362if (__DEV__) {
5463 // Use this to detect multiple renderers using the same context
@@ -94,6 +103,8 @@ export function pushProvider<T>(
94103
95104 context . _currentValue = nextValue ;
96105 if ( __DEV__ ) {
106+ push ( rendererCursorDEV , context . _currentRenderer , providerFiber ) ;
107+
97108 if (
98109 context . _currentRenderer !== undefined &&
99110 context . _currentRenderer !== null &&
@@ -111,6 +122,8 @@ export function pushProvider<T>(
111122
112123 context . _currentValue2 = nextValue ;
113124 if ( __DEV__ ) {
125+ push ( renderer2CursorDEV , context . _currentRenderer2 , providerFiber ) ;
126+
114127 if (
115128 context . _currentRenderer2 !== undefined &&
116129 context . _currentRenderer2 !== null &&
@@ -131,7 +144,7 @@ export function popProvider(
131144 providerFiber: Fiber,
132145): void {
133146 const currentValue = valueCursor . current ;
134- pop ( valueCursor , providerFiber ) ;
147+
135148 if ( isPrimaryRenderer ) {
136149 if (
137150 enableServerContext &&
@@ -141,6 +154,11 @@ export function popProvider(
141154 } else {
142155 context . _currentValue = currentValue ;
143156 }
157+ if ( __DEV__ ) {
158+ const currentRenderer = rendererCursorDEV . current ;
159+ pop ( rendererCursorDEV , providerFiber ) ;
160+ context . _currentRenderer = currentRenderer ;
161+ }
144162 } else {
145163 if (
146164 enableServerContext &&
@@ -150,7 +168,14 @@ export function popProvider(
150168 } else {
151169 context . _currentValue2 = currentValue ;
152170 }
171+ if (__DEV__) {
172+ const currentRenderer2 = renderer2CursorDEV . current ;
173+ pop ( renderer2CursorDEV , providerFiber ) ;
174+ context . _currentRenderer2 = currentRenderer2 ;
175+ }
153176 }
177+
178+ pop ( valueCursor , providerFiber ) ;
154179}
155180
156181export function scheduleContextWorkOnParentPath (
0 commit comments