Skip to content

fix: Override bind items for combobox#8803

Merged
mshabarov merged 10 commits intomainfrom
override-bind-items-for-combobox
Mar 9, 2026
Merged

fix: Override bind items for combobox#8803
mshabarov merged 10 commits intomainfrom
override-bind-items-for-combobox

Conversation

@mshabarov
Copy link
Copy Markdown
Contributor

@mshabarov mshabarov commented Feb 27, 2026

ComboBox requires filter convertor and thus fails for generic data provider. This PR adds:

  • overload for bindItems that takes the converter
  • overload for bindItems that uses default items filter (uses items label generator and contains)
  • unit tests for both methods
  • E2E test.

E2E test uses a custom equality checker for value signal and re-uses the Person entity class which equality is based in ID: ComboBox uses ID for refreshing items, whereas item signals should use some other equality (first name + last name), because otherwise signals skip calling the effects and value updates if they see equal values.

Related-to vaadin/flow#23659

@mshabarov mshabarov marked this pull request as ready for review March 3, 2026 09:20
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

@DiegoCardoso DiegoCardoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this test fails when it shouldn't:

    @Test(expected = BindingActiveException.class)
    public void bindItems_thenSetItems_throws() {
        var listSignal = new ValueSignal<>(List.of(new ValueSignal<>("Alice")));

        comboBox.bindItems(listSignal);
        ui.add(comboBox);

        comboBox.setItems("Bob");
    }

But, as discussed internally, it should be addressed separately.

@mshabarov mshabarov merged commit 3252a98 into main Mar 9, 2026
6 checks passed
@mshabarov mshabarov deleted the override-bind-items-for-combobox branch March 9, 2026 11:22
@github-project-automation github-project-automation Bot moved this from 🔎Iteration reviews to Done in Vaadin Flow | Hilla | Kits ongoing work Mar 9, 2026
vaadin-bot pushed a commit that referenced this pull request Mar 9, 2026
ComboBox requires filter convertor and thus fails for generic data provider. This PR adds:

overload for bindItems that takes the converter
overload for bindItems that uses default items filter (uses items label generator and contains)
unit tests for both methods
E2E test.
E2E test uses a custom equality checker for value signal and re-uses the Person entity class which equality is based in ID: ComboBox uses ID for refreshing items, whereas item signals should use some other equality (first name + last name), because otherwise signals skip calling the effects and value updates if they see equal values.

Related-to vaadin/flow#23659
mshabarov added a commit that referenced this pull request Mar 9, 2026
ComboBox requires filter convertor and thus fails for generic data provider. This PR adds:

overload for bindItems that takes the converter
overload for bindItems that uses default items filter (uses items label generator and contains)
unit tests for both methods
E2E test.
E2E test uses a custom equality checker for value signal and re-uses the Person entity class which equality is based in ID: ComboBox uses ID for refreshing items, whereas item signals should use some other equality (first name + last name), because otherwise signals skip calling the effects and value updates if they see equal values.

Related-to vaadin/flow#23659

Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
@vaadin-bot
Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.2.0-alpha2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

5 participants