Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure limit is reset when initialCount is disabled. #5640

Merged

Conversation

kevinpschaaf
Copy link
Member

@kevinpschaaf kevinpschaaf commented Mar 3, 2020

Resolves a corner-case issue with the previous fix in #5632, where rendering an empty list (items.length===0), setting the initialCount to 0, and then attempting to render a list with items.length > 0 could cause the list to be stuck in an unrendered state.

Note that any falsey value for initialCount (including 0) is interpreted as "chunking disabled". This is consistent with 1.x logic, and follows from the logic of "starting chunking by rendering zero items" doesn't really make sense.

Also took the opportunity while adding a new test to refactor the chunking tests to use async/await for better readability.

Reference Issue

Fixes #5631

Note that any falsey value for initialCount (including `0`) is interpreted as "chunking disabled". This is consistent with 1.x logic, and follows from the logic of "starting chunking by rendering zero items" doesn't really make sense.
…a test for that.

Also:
* Ensure `__itemsArrayChanged` is cleared after every render.
* Enqueue `__continueChunkingAfterRaf` before notifying renderedItemCount for safety
Safari 9 is now very old, and has micro task ordering bugs issues that make testing flaky.
lib/elements/dom-repeat.js Show resolved Hide resolved
lib/elements/dom-repeat.js Outdated Show resolved Hide resolved
lib/elements/dom-repeat.js Outdated Show resolved Hide resolved
This centralizes the calculation of limit based on changes to other state variables.
Also, use instances length instead of renderedItemCount since it will be undefined on first render.
@kevinpschaaf kevinpschaaf force-pushed the legacy-undefined-noBatch-5631-2 branch from 15b0247 to ddb37df Compare March 5, 2020 06:50
@kevinpschaaf kevinpschaaf merged commit 22e1d02 into legacy-undefined-noBatch Mar 5, 2020
@kevinpschaaf kevinpschaaf deleted the legacy-undefined-noBatch-5631-2 branch March 5, 2020 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants