Can't calculate queryParams after controller loads

My use case: Create a faceted search widget from an array of facets from a remote source and store the selected facet state as queryParams.

Problem: I don’t know what the facet categories will be until after the FacetsController has received the data. By that time it’s too late to setup queryParams on the controller (the empty cacheMeta property causes _qpChanged to throw a TypeError.)

I don’t have a lot of good solutions. I’m looking at either hard coding all the possible facet categories into the controller (which will cause future headaches if new facet categories appear), or else not use queryParams at all for saving facet state.

Suggestions very welcome,

Thanks

1 Like