Skip to content

fix: list > reduce update cycles#6634

Open
GZolla wants to merge 2 commits intomainfrom
gzolla/inspiration-list-updates
Open

fix: list > reduce update cycles#6634
GZolla wants to merge 2 commits intomainfrom
gzolla/inspiration-list-updates

Conversation

@GZolla
Copy link
Contributor

@GZolla GZolla commented Feb 25, 2026

GAUD-9528

The changes are really straightforward, I've gone over the changes and I believe all the changes in the updated don't depend on dom rendering. It's worth a sanity check though.

Reverted changes to PageableMixin because consumers that depend on elements being loaded could fail otherwise. This means that list would still throw the warning on demos.

@GZolla GZolla requested a review from a team as a code owner February 25, 2026 21:46
@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-6634/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

super.updated(changedProperties);
willUpdate(changedProperties) {
super.willUpdate(changedProperties);
if (changedProperties.has('breakpoints') && changedProperties.get('breakpoints') !== undefined) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does depend on sizing, but the resize observer handles changes in size. This means that this check only exists for the case where breakpoints change but no resizing takes place, in which case using willUpdate is appropriate.

@dbatiste
Copy link
Contributor

How many updates are happening before/after the changes?

Generally I think using willUpdate is preferred to reduce updates, but I also know that the list and all its selection logic (and other stuff) is sensitive to timing.

I believe the breakpoints might be responsible for a duplicate render cycle, and is one of the things we've wanted to remove/improve.

@GZolla
Copy link
Contributor Author

GZolla commented Feb 26, 2026

How many updates are happening before/after the changes?

Generally I think using willUpdate is preferred to reduce updates, but I also know that the list and all its selection logic (and other stuff) is sensitive to timing.

I believe the breakpoints might be responsible for a duplicate render cycle, and is one of the things we've wanted to remove/improve.

On list, you're correct that changing breakpoints does add an extra cycle each time they change. The rest of the changes on the updated method update children. Since the children are update after an update cycle there is an entire cycle where the 2 are mismatched. This is maybe not a big deal but it does cause some weird intermediate states, like when changing list layout:
image
This are unperceivable as far as I can tell, but still might be worth the change.

Selection should not be affected, behavior that does change include:
On list:

  • When add button is added subscribers are updated immediately
  • Disables selection mixin arrow keys as soon as grid is set
  • layout, selectectionWhenInteracted, dragHandleShowAlways are set on children immediately

On list-item:

  • As expandable is set, the slot is rendered in the same cycle
  • The dragover timing starts immediately
  • Loading spinner is removed as soon _hasNestedList is true (could not repro but theoretically both the list and the spinner could render for a cycle)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants