Draft: WEBDEV-6266 Render cells within the usual component lifecycle #7
+76
−45
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.
Currently, the infinite scroller on its first render pass creates empty shells for cell content, but the actual
cell content (or placeholders) is only subsequently rendered into those afterwards, outside of the usual Lit lifecycle.
This strategy has worked reasonably well, but it also leads to a number of undesired behaviors, including a resistance to SSR (which requires all content to be rendered on the first pass regardless of cell visibility) and unusual behavior when the content needs to be reloaded (flickering during the “empty shells” limbo, and manual effort required by the consumer to ensure prior pages of content actually get displayed when they load in).
This PR updates the infinite scroller component to preserve its scroll-optimized behavior while also making its render cycles much more standard for a Lit component, which should make it easier to work with overall. To accomplish this, instead of rendering directly into cell containers upon visibility changes, we just update which sets of cell indices should render content/placeholder/nothing and kick off a proper component render pass to actually fill the cells with that content the usual declarative Lit way.