Skip to content

Commit

Permalink
fix(combobox): fix error that occurs in dist-custom-elements (compone…
Browse files Browse the repository at this point in the history
…nts) output when a click is emitted when the component is appended to the DOM (#9423)

**Related Issue:** #9321

## Summary

This updates the combobox window-click listener to use an internal state
property for its text instead of getting the value of the internal
input.

The `componentOnReady` util helps normalize waiting for a component to
be ready in both output targets (based on [Ionic's
helper](https://github.com/ionic-team/ionic-framework/blob/5cdfa1aaf47a6160cd1bd2be434dcfa8390b56e1/core/src/utils/helpers.ts#L60-L79)).
This is sufficient for most scenarios, but for this particular case, it
was running earlier than `connectedCallback` due to the emitted click as
the component is appended and initialized, so the component is not yet
rendered by the time the util resolves.

**Note**: there are no accompanying tests as this is not reproducible in
the test environment, which uses the lazy-loaded output.
  • Loading branch information
jcfranco authored May 28, 2024
1 parent c8743c1 commit ab521c9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export class Combobox

await componentOnReady(this.el);

if (!this.allowCustomValues && this.textInput.value) {
if (!this.allowCustomValues && this.text) {
this.clearInputValue();
this.filterItems("");
this.updateActiveItemIndex(-1);
Expand Down

0 comments on commit ab521c9

Please sign in to comment.