Remove some statefulness from SSR stack handling#13155
Closed
gaearon wants to merge 2 commits intofacebook:masterfrom
Closed
Remove some statefulness from SSR stack handling#13155gaearon wants to merge 2 commits intofacebook:masterfrom
gaearon wants to merge 2 commits intofacebook:masterfrom
Conversation
Details of bundled changes.Comparing: 96d38d1...c599f59 react-dom
Generated by 🚫 dangerJS |
This was referenced Jul 6, 2018
I found it quite difficult to understand what's going on because of multiple "stacks": this.frames, a pointer to the "current" this.frames, and a currentDebugElementStack which is being kept in sync with it. This refactors it to be an argument instead since the only place where we use it is down the (haha) call stack and we don't actually need it to be stateful. Note this doesn't change the behavior and still has existing issues with re-entrancy.
Collaborator
Author
|
I'll do #13181 instead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I started looking into fixing #10188 (which I think would be good before we do #13149), but it was really hard to understand what's going on in the SSR stack handling because of the unnecessary mutable state.
I added a detailed test to capture regressions to this part of the code, and then refactored it to remove the stateful
currentDebugElementStack. We could already get it from the frame if we only passed it down, which is what I’m doing. This also makes the!== nullcheck motivated in this comment unnecessary because even if it's re-entrant, we're going to access the right reference from the argument.In a follow up, I'll try to fix reentrancy for SSR (and add test coverage around that).