Currently, the Bulk Edit Products page loads all pages regardless of how much you scroll. You might want to see only the first one. This adds a totally unnecessary load on the server.
services/bulk_products.js.coffee uses PagedFetcher to load them async.
This stems from https://github.com/openfoodfoundation/ofn-install/issues/477#issuecomment-514677459
This should cut the negative impact on performance this page has which seems to be causing serious downtime.
anyone familiar with this code and why it was designed that way? @mkllnk @luisramos0 @Matt-Yorkley @kristinalim ?
I'll take this one, if nobody minds. I'm thinking we just implement a simpler pagination, like in the new orders page.
I know pageFetcher, I think I made it use promises at some point, last time I looked at it I found this problem: https://github.com/openfoodfoundation/openfoodnetwork/pull/3911#issuecomment-501810292
Maybe #3911 can be part of this issue (it's just "sort entries alphabetically").
Anyway, this pageFetcher is for fetching all pages which is what we need to stop doing here :-)
I think we have discussed this somewhere else, but anyway: this is a brilliant opportunity to make this page use the API (api/products) and get some nice pagination in the API as an API exemplar :-) #4070
For example, move this in api/products from bulk_products to index (I dont think index is being used)
fyi spree/api/products_controller_decorator will be in spree/api/products_controller after this.
I think the PageFetcher was written to get around timeouts, have a quicker response but still keep the full functionality. Moving the searching to the backend and using pagination is a better idea though. Happy for you to go ahead.