From 2c44778ab9aed093f1f63fb086f986c462d9dc50 Mon Sep 17 00:00:00 2001 From: Chris Poucet Date: Thu, 17 Aug 2023 17:16:16 +0200 Subject: Ensure we don't end up in an infinite loop when updating path. 1. Don't call handleValueChange if gr-drop-down-list hasn't actually changed value Analysis: - Navigate to https://go-review.googlesource.com/c/go/+/494187/29/src/runtime/trace2buf.go - gr-diff-view eventually ends up with this.path = src/runtime/trace2buf.go. - Press Shift+m - handleNextUnreviewedFile gets called - this.setReviewed(true) gets called - this.navigateToUnreviewedFile('next') - this.naveToFile gets called which computes newPath src/runtime/trace2cpu.go - this.getChangeModel().navigateToDiff gets called wit the newPath - Before the model has time to finish updating gr-diff-view, the header gets re-rerendered due to this.setReviewed(true) - this.path gets updated based on the listener for this.getViewModel().diffPath$ - gr-dropdown-list.willUpdate is called based on the re-render of #8, it still has the old path. It's items' have changed but not its `path. - This triggers the spin-locking back and forth. Google-Bug-Id: b/296388347 Release-Notes: skip Change-Id: I88196b34ddb037809ece6952555cb82e41171ad2 (cherry picked from commit 687f1203adf46755149dbdcec0069fb6b7571dfa) --- polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts index 9b74e24221..465afce951 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts +++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts @@ -187,7 +187,7 @@ export class GrDropdownList extends LitElement { } protected override willUpdate(changedProperties: PropertyValues): void { - if (changedProperties.has('items') || changedProperties.has('value')) { + if (changedProperties.has('value')) { this.handleValueChange(); } } -- cgit v1.2.3