Using searchParameter filters in instantsearch.js v4

I am trying to filter a set of results by a facet on first load, and keep that facet filter always applied regardless if any other facets are added by the user.

I accomplished this (community post where I was initially figuring this out in v2) in instantsearch v2 with the searchParameter option that was dropped in v4.

I was using it in this fashion:

instantsearch({
    indexName: 'IndexName',
    searchClient: searchClient,
    searchParameters: {
        filters:  'FacetProperty:FacetValue'
    }
});

How can I accomplish the desired behaviour of applying a facet, and having that facet not be able to be removed as the user searches and adds other refinements?

I tried using the configure widget which worked great for having the results be initially refined:

    search.addWidget(
        instantsearch.widgets.configure({
            // See: https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/
            facetFilters: [
                'FacetProperty:FacetValue'
            ]
        })
    );

However as soon as you add any refinements using the refinementList widget, it overrides the configure parameter.

Is there another way to apply a refinement to the search ui that cannot be removed or impacted? Perhaps through the search client?

Also of note, I do not want the pre-filtered value to show up in routing.

Thank you in advance!

I believe I have achieved my aim with this post by using the “filter” option on the configure widget :grinning_face_with_smiling_eyes: :+1::

search.addWidget(
    instantsearch.widgets.configure({
        // See: https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/
        // See: https://www.algolia.com/doc/api-reference/api-parameters/filters/
        filters: 'FacetProperty:FacetValue'
        })
);

Code example of this implemented: Algolia Instantsearch demo (forked) - CodeSandbox
Hopefully this helps others!