vendure
vendure copied to clipboard
Add pagination for FacetValues
Hello 👋 Is your feature request related to a problem? Please describe. In our DB, we have a lot of FacetValues for a single Facet, like a city facet that contains a large list of facetValue as city name. Sometimes we want to query to get all the facetValues from a facet. In order to optimize our performance, we want to paginate the results of it.
Describe the solution you'd like
Like the FacetService, for the query :
findAll(ctx: RequestContext, options?: ListQueryOptions<Facet>)
We would like to have the same for the FacetValueService
findByFacetId(ctx: RequestContext, id: ID, options?: ListQueryOptions<FacetValue>)
Hi,
We had a similar issue some time ago with Product.variants
which is just a flat array of all variants. So to solve that I added the variantsList
field, which is a paginated list type. At the service layer, it was implemented in the same way that you describe here.
So I think this is a worthy addition and I'll add it at some point. Unfortunately just missed out on making it into the next minor release, but potentially the one after that.
No problem it's not urgent for us now but thanks to take it in account 🙏
For me is a little bit more urgent not only for the service layer but also in the admin-ui is important to have because is impossible to edit when you have thousand of facet value. For the admin-ui I add a specific issue because the issue is that you cannot save when there are many many facetvalues in the same facet.
Is there some update on it?
I see planned but I do not understand which milestone
Thanks
+1 any update on this? Admin-UI is kind of broken with lots of facet values...
Hi all!
Thanks for bringing my attention back to this one.
@floze how many facet values are we talking? And is it just the facet detail page that is kind of broken?
@michaelbromley It's not just the facets-detail page, although the facets-overview page (/admin/catalog/facets
) at least seems to render completely, albeit with heavy load. The problem is not so much the backend, but the browser that appears to be choking on the rendering. I'm using Brave, but Safari seems to be affected as well.
As @giosueDelgado mentioned, the problem seems to arise with thousands of values per facet, hundreds are still loading nicely on my end.
Hi yes we have 2/3k of facet values... on some facet
OK thanks both for the feedback.
I'm gonna look into the best fix for now - which might be just to make the Admin UI smarter and not try to render everything. If this handles the immediate perf issues I can possibly get this in the next patch.
OK I have started implementing the fix for this in the minor
branch. Still need to do the facet detail page, which is quite a bit more complex.