Open GrantRussell opened 1 year ago
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.
π Feature Request
On initial load, it would be nice if the
sort
option in useAsyncList was automatically called if theinitialSortDescriptor
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 thesort
option.π€ Expected Behavior
When passing a
sort
andinitialSortDescriptor
option,useAsyncList
would automatically call the passedsort
option upon resolving the initialasync 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 thesort
option touseAsyncList
. 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)