diff options
author | Chris Poucet <poucet@google.com> | 2023-08-17 17:16:16 +0200 |
---|---|---|
committer | Paladox none <thomasmulhall410@yahoo.com> | 2023-08-19 14:26:47 +0000 |
commit | 2c44778ab9aed093f1f63fb086f986c462d9dc50 (patch) | |
tree | b7144e73cd4e32a1613a435647140d5b48487c98 | |
parent | cfb981057f878b19a91ee61334e4a54e62fbf424 (diff) |
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)
-rw-r--r-- | polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.ts | 2 |
1 files changed, 1 insertions, 1 deletions
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(); } } |