hubmapconsortium / portal-ui

HuBMAP Data Portal front end
https://portal.hubmapconsortium.org
MIT License
12 stars 2 forks source link

NickAkhmetov/CAT-634 Fix selection of samples on organ page when more than 500 are present #3595

Closed NickAkhmetov closed 2 weeks ago

NickAkhmetov commented 2 weeks ago

Summary

The Kidney page on prod currently fails to select all results when using the "select all" checkbox of the samples table. This issue was caused by the useAllSearchIds hook being limited to only fetching the first 500 results. Lifting this limit/removing the "number of pages to fetch" from the ID lookup resolved this issue by enabling lookup of all 634 results in the table.

Design Documentation/Original Tickets

https://hms-dbmi.atlassian.net/browse/CAT-634

Testing

Tested on the kidney page as well as other organ pages.

Screenshots/Video

https://github.com/user-attachments/assets/345dc850-6b0c-404e-8df7-a60bb7c0b031

Checklist

Additional Notes

I'm not sure if this PR overlaps with the changes in the searchkit PR - it can definitely wait if so.

NickAkhmetov commented 2 weeks ago

Following John's feedback, I've made some improvements to the fetchAllIds functionality, using an async generator to sequentially request all the IDs for a given search request's results.

On login with HuBMAP Read, there are >20,000 kidney samples, so I was able to confirm the fix:

https://github.com/user-attachments/assets/3be82ec0-05f5-41b3-96fe-abc6c7234fc0

It is worth noting that adding the selected to a list caused the page to freeze. This might become a bigger issue if we start persisting lists in a key-value store.