Large number of partner makes the product catalogue dashboard slow to load
The page at /catalogue/products/42/?#product_stock uses an HTML <select> per stockrecord.
This is OK when there's either a small number of stockrecords per product or a small number of partners.
But if a product have many stockrecords and the shop has many partners it generates a huge HTML (number of stockrecords times number of partner). Server side it survives, but the browser takes a long time to parse it / render it.
I did a test with 1k partners, if a product have:
| qty of stockrecord | bytes for the html |
|---|---|
| 1 | 220224 |
| 2 | 280274 |
| 3 | 340324 |
| 4 | 400374 |
So for a product with say 50 stockrecords it's 3 MB of HTML.
In one instance we have ~10k partners, so for 50 stockrecords I bet we have 30MB of HTML, the browser don't like that :D
I see some JS is replacing those HTML <select>s with a select2 so a fix could be to place a single list of partners in the page somewhere instead of having it copied on every <select>? The select2 could use the single list as a data source and it should work? (I'm bad at front-end).
Source: django-oscar/django-oscar