[UseAsyncList] Support automatic client-side sorting after initial load
๐ Feature Request
On initial load, it would be nice if the sort option in useAsyncList was automatically called if the initialSortDescriptor option is also provided.
Alternatively, if this is not possible, it would be nice to update the doc page for useAsyncList to explicitly show that the user is responsible for managing the sort. The current documentation gives the impression that client-side sorting will be applied after implementing the provided code example, when in reality the final step is to manually call the sort option.
๐ค Expected Behavior
When passing a sort and initialSortDescriptor option, useAsyncList would automatically call the passed sort option upon resolving the initial async load.
๐ฏ Current Behavior
Currently, the user is responsible for managing when the first client-side sort is applied, even though the expectation would be to apply the sort automatically especially if an initialSortDescriptor is also provided.
๐ Possible Solution
See Expected Behavior
๐ฆ Context
After reading examples in the documentation of useAsyncList, it gives the impression that client-side sorting will be applied after supplying the sort option to useAsyncList. This doesn't seem to be the case, but the docs also don't offer any suggestions on how to apply that first sort.
๐ป Examples
https://codesandbox.io/s/listview-with-useasynclist-4cozi2?file=/src/App.js
๐งข Your Company/Team
Adobe Assets Essentials
๐ Tracking Ticket (optional)
Discussed with the team further. We'll want to update the docs here to be clear about how to perform sorting here since we don't know what exactly the user provided sort function will do (it might be server side and we'd want to avoid firing another network request).
Hi there ! Bumping this issue as this was effectively not straightforward behavior...
This caught me off guard as well. I'd love some recommendations on how to have the list use my sort function on load on the client only.