@@ -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 &&
@@ -142,7 +155,9 @@ export function popProvider(
142155 context . _currentValue = currentValue ;
143156 }
144157 if ( __DEV__ ) {
145- context . _currentRenderer = null ;
158+ const currentRenderer = rendererCursorDEV . current ;
159+ pop ( rendererCursorDEV , providerFiber ) ;
160+ context . _currentRenderer = currentRenderer ;
146161 }
147162 } else {
148163 if (
@@ -154,9 +169,13 @@ export function popProvider(
154169 context . _currentValue2 = currentValue ;
155170 }
156171 if (__DEV__) {
157- context . _currentRenderer2 = null ;
172+ const currentRenderer2 = renderer2CursorDEV . current ;
173+ pop ( renderer2CursorDEV , providerFiber ) ;
174+ context . _currentRenderer2 = currentRenderer2 ;
158175 }
159176 }
177+
178+ pop ( valueCursor , providerFiber ) ;
160179}
161180
162181export function scheduleContextWorkOnParentPath (
0 commit comments