Fix initially suspended component under sCU#1660
Draft
sventschui wants to merge 1 commit into
Draft
Conversation
Member
|
guess it's similar to what we do for context https://github.com/preactjs/preact/blob/master/src/create-context.js#L25 |
Member
Author
|
Yes it's similar but with the issue that we want to "postpone" the update of the dom but not the re-render because:
|
Thompson1985
approved these changes
Oct 6, 2024
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.
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 suspendedtest.My first approach was to patch the
_parentDomattribute and then callforceUpdate()on the component that suspended. The problem with this is, that when this component is directly underSuspensethat it will show up (modify the DOM) too soon.The second approach (this PR) is to not patch the
_parentDombut callforceUpdate()on the_ancestorComponentof 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._parentDomand callforceUpdateon all suspending components once all of them finished.