Skip to content

Commit

Permalink
Inline loop
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Feb 14, 2019
1 parent 781dd45 commit 94f70f5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/react-dom/src/server/ReactPartialRenderer.js
Expand Up @@ -749,7 +749,7 @@ class ReactDOMServerRenderer {
context[threadID] = provider.props.value;
}

popProvider<T>(provider?: ReactProvider<T>): void {
popProvider<T>(provider: ReactProvider<T>): void {
const index = this.contextIndex;
if (__DEV__) {
warningWithoutStack(
Expand Down Expand Up @@ -778,12 +778,11 @@ class ReactDOMServerRenderer {
}

clearProviders(): void {
while (this.contextIndex > -1) {
if (__DEV__) {
this.popProvider((this.contextProviderStack: any)[this.contextIndex]);
} else {
this.popProvider();
}
// Restore any remaining providers on the stack to previous values
for (let index = this.contextIndex; index >= 0; index--) {
const context: ReactContext<any> = this.contextStack[index];
const previousValue = this.contextValueStack[index];
context[this.threadID] = previousValue;
}
}

Expand Down

0 comments on commit 94f70f5

Please sign in to comment.