@@ -49,6 +49,15 @@ import {REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED} from 'shared/ReactSymbols
49
49
50
50
const valueCursor : StackCursor < mixed > = createCursor(null);
51
51
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
+
52
61
let rendererSigil;
53
62
if (__DEV__) {
54
63
// Use this to detect multiple renderers using the same context
@@ -94,6 +103,8 @@ export function pushProvider<T>(
94
103
95
104
context . _currentValue = nextValue ;
96
105
if ( __DEV__ ) {
106
+ push ( rendererCursorDEV , context . _currentRenderer , providerFiber ) ;
107
+
97
108
if (
98
109
context . _currentRenderer !== undefined &&
99
110
context . _currentRenderer !== null &&
@@ -111,6 +122,8 @@ export function pushProvider<T>(
111
122
112
123
context . _currentValue2 = nextValue ;
113
124
if ( __DEV__ ) {
125
+ push ( renderer2CursorDEV , context . _currentRenderer2 , providerFiber ) ;
126
+
114
127
if (
115
128
context . _currentRenderer2 !== undefined &&
116
129
context . _currentRenderer2 !== null &&
@@ -131,7 +144,7 @@ export function popProvider(
131
144
providerFiber: Fiber,
132
145
): void {
133
146
const currentValue = valueCursor . current ;
134
- pop ( valueCursor , providerFiber ) ;
147
+
135
148
if ( isPrimaryRenderer ) {
136
149
if (
137
150
enableServerContext &&
@@ -142,7 +155,9 @@ export function popProvider(
142
155
context . _currentValue = currentValue ;
143
156
}
144
157
if ( __DEV__ ) {
145
- context . _currentRenderer = null ;
158
+ const currentRenderer = rendererCursorDEV . current ;
159
+ pop ( rendererCursorDEV , providerFiber ) ;
160
+ context . _currentRenderer = currentRenderer ;
146
161
}
147
162
} else {
148
163
if (
@@ -154,9 +169,13 @@ export function popProvider(
154
169
context . _currentValue2 = currentValue ;
155
170
}
156
171
if (__DEV__) {
157
- context . _currentRenderer2 = null ;
172
+ const currentRenderer2 = renderer2CursorDEV . current ;
173
+ pop ( renderer2CursorDEV , providerFiber ) ;
174
+ context . _currentRenderer2 = currentRenderer2 ;
158
175
}
159
176
}
177
+
178
+ pop ( valueCursor , providerFiber ) ;
160
179
}
161
180
162
181
export function scheduleContextWorkOnParentPath (
0 commit comments