Fix initially suspended component under sCU #1660
Draft
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.
So the parking approach to suspense has an issue when the suspending component suspends on the first render (as lazy() does) and is under a component with an sCU that returns false. This is represented by the newly added
should work throughout sCU when initially being suspended
test.My first approach was to patch the
_parentDom
attribute and then callforceUpdate()
on the component that suspended. The problem with this is, that when this component is directly underSuspense
that it will show up (modify the DOM) too soon.The second approach (this PR) is to not patch the
_parentDom
but callforceUpdate()
on the_ancestorComponent
of the suspending component. This seems to work but feels wrong. It also breaks other tests since it will result in some render methods being called too often.Other thoughts I will explore:
PatchThis seems wrong as a suspending component might suspend again._parentDom
and callforceUpdate
on all suspending components once all of them finished.