Async Combobox not rendering initial result
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
### Provide a general summary of the issue here
combobox does not render a list of results from an initially empty or undefined list given a search query. however each subsequent query change will render a list.
### 🤔 Expected Behavior?
Combobox popover should render a list of results from an initially empty or undefined async response in the first instance.
### 😯 Current Behavior
At present, the current example provided by the docs for an async combobox does an initial fetch on page render. great for small lists, not so great for searching for an amazon product or returning an address from google places api. I added a small predicate in the useAsyncList list callback to only search when the filterText length is greater than 0. this takes care of the initial fetch however it appears the popover is now no longer synced with the state of the combobox because when there IS a list of results in the first instance, popover does not render a list. however with each new request after the first one that has results, it will flash the initial list before quickly showing the 'current' list.
### 💁 Possible Solution
_No response_
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
Example can be found [here](https://codesandbox.io/s/eloquent-burnell-7m9wrl?file=/src/App.tsx)
Its taken straight from the docs example under the RAC combobox async docs (an actual async RAC combobox code example would be nice though). all ive added is a console log to track the items passed to combobox and a predicate to prevent initial render.
1. open link provided above, observe console log to see full initial list returned on page load.
2. uncomment first line in useAsyncList 'load' callback to prevent initial fetch
3. type in letter 'L' (lowercase) and watch for console output of returned list with no initial popover being rendered
4. type in letter 'u' and observe the 'initial' results list immediately render until its replaced by the new list
### Version
3.29.0 (react-aria)
### What browsers are you seeing the problem on?
Chrome
### If other, please specify.
_No response_
### What operating system are you using?
Windows 11
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.