Skip to content

ComboBox with asynchronous loading doesn't render empty state when filtering #8708

@more2thestory

Description

@more2thestory

Provide a general summary of the issue here

I have implemented a combo box according to the Asynchronous loading section in the docs. When there are no items to be shown in the list, I'd like to render a "No items found" message using the renderEmptyState prop. This works for the initial render of the list, but not when the user types in the input field.

🤔 Expected Behavior?

The empty state should be rendered when there are no items to be shown, regardless of whether the collection contains no items, or whether the current input value results in no matching items to be shown.

😯 Current Behavior

The empty state is only shown on the initial render of the list, when the collection itself is empty. But when a list is being filtered using the input, the empty state is not rendered.

💁 Possible Solution

No response

🔦 Context

I need users to select an option from a very large dataset that I don't want to fully load. So I'm trying to have the combo box load items asynchronously, not only on initial render, but also whenever the user types in the input field.

🖥️ Steps to Reproduce

Compare the behavior of the two combo boxes here:
https://stackblitz.com/edit/rac-async-combobox-empty-state?file=src%2FApp.tsx

Version

react-aria-components 1.11.0

What browsers are you seeing the problem on?

Firefox, Chrome, Microsoft Edge

If other, please specify.

No response

What operating system are you using?

Windows 10

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions