vendure icon indicating copy to clipboard operation
vendure copied to clipboard

Add pagination for FacetValues

Open bobby91560 opened this issue 3 years ago • 2 comments

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>)

bobby91560 avatar Dec 06 '21 16:12 bobby91560

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.

michaelbromley avatar Dec 08 '21 09:12 michaelbromley

No problem it's not urgent for us now but thanks to take it in account 🙏

bobby91560 avatar Dec 10 '21 10:12 bobby91560

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.

giosueDelgado avatar Jan 09 '23 08:01 giosueDelgado

Is there some update on it?

I see planned but I do not understand which milestone

Thanks

giosueDelgado avatar Mar 10 '23 16:03 giosueDelgado

+1 any update on this? Admin-UI is kind of broken with lots of facet values...

floze avatar Jul 25 '23 17:07 floze

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 avatar Jul 25 '23 19:07 michaelbromley

@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.

floze avatar Jul 26 '23 14:07 floze

Hi yes we have 2/3k of facet values... on some facet

giosueDelgado avatar Jul 26 '23 14:07 giosueDelgado

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.

michaelbromley avatar Jul 27 '23 06:07 michaelbromley

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.

michaelbromley avatar Jul 27 '23 09:07 michaelbromley