File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
packages/react-dom/src/server Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -749,7 +749,7 @@ class ReactDOMServerRenderer {
749
749
context [ threadID ] = provider . props . value ;
750
750
}
751
751
752
- popProvider < T > ( provider ? : ReactProvider < T > ) : void {
752
+ popProvider < T > ( provider : ReactProvider < T > ) : void {
753
753
const index = this . contextIndex ;
754
754
if ( __DEV__ ) {
755
755
warningWithoutStack (
@@ -778,12 +778,11 @@ class ReactDOMServerRenderer {
778
778
}
779
779
780
780
clearProviders ( ) : void {
781
- while ( this . contextIndex > - 1 ) {
782
- if ( __DEV__ ) {
783
- this . popProvider ( ( this . contextProviderStack : any ) [ this . contextIndex ] ) ;
784
- } else {
785
- this . popProvider ( ) ;
786
- }
781
+ // Restore any remaining providers on the stack to previous values
782
+ for ( let index = this . contextIndex ; index >= 0 ; index -- ) {
783
+ const context : ReactContext < any > = this . contextStack [ index ] ;
784
+ const previousValue = this . contextValueStack [ index ] ;
785
+ context [ this . threadID ] = previousValue ;
787
786
}
788
787
}
789
788
You can’t perform that action at this time.
0 commit comments