-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix(combobox, input-time-zone): fix initial item selection delay #11326
base: dev
Are you sure you want to change the base?
fix(combobox, input-time-zone): fix initial item selection delay #11326
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -119,7 +115,9 @@ export class Combobox | |||
|
|||
defaultValue: Combobox["value"]; | |||
|
|||
private emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@@ -1229,15 +1229,19 @@ export class Combobox | |||
return this.filterText === "" ? this.items : this.items.filter((item) => !item.hidden); | |||
} | |||
|
|||
private updateItems = debounce((): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we still debounce this in some cases? Like the mutation observer case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could keep an eye out for this. The MO callback kicks in once per batch of mutations, so I don't expect a significant increase in updateItem
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. We may want to have some internal doc/guidelines on when we should debounce a function and under what circumstances.
this.getItems().forEach((item) => { | ||
item.selected = Array.isArray(value) | ||
? value.includes(item.value) | ||
: value | ||
? value === item.value | ||
: false; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.getItems().forEach((item) => { | |
item.selected = Array.isArray(value) | |
? value.includes(item.value) | |
: value | |
? value === item.value | |
: false; | |
}); | |
for (const item of this.getItems()) { | |
item.selected = (Array.isArray(value) && value.includes(item.value)) || | |
(!Array.isArray(value) && value === item.value); | |
} |
I noticed some diffs on the initial render. Looking into this. |
Related Issue: #10731
Summary
Fixes a combobox regression introduced by #11265 without impacting performance.
Notable changes