-
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
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. |
* origin/dev: (322 commits) chore: add ui icons package to enhancement template (#11344) chore(table): move workaround comment back to its usage (#11341) ci(actions): refine remove-issue-from-design-projects workflow (#11325) chore(actions): add icon leads notification for calcite-ui-icons requests (#11263) test(combobox): use async expect for non-throwing test case (#11332) fix(combobox, input-time-zone): fix initial item selection delay (#11326) build(deps): update dependency type-fest to v4.32.0 (#11308) chore(utility-network-layer, crosshair): add font codepoints (#11336) refactor(loadable): deprecate obsolete helpers (#11312) chore: release next feat: add crosshair (#11331) build(deps): update arcgis to ^4.32.0-next.81 (#11273) ci(actions): add action to remove issues from design projects (#11249) chore: release next fix(list-item): reflect the sortHandleOpen property (#11323) refactor(block): heading text color (#11314) chore: release next fix(list): only focus on row when clicking a list item (#11310) fix(tooltip, popover): honor prevented events (#11278) chore: release next ...
Related Issue: #10731
Summary
Fixes a combobox regression introduced by #11265 without impacting performance.
Notable changes