Skip to content

Commit

Permalink
fix: set query in facets module from selecting a query preview
Browse files Browse the repository at this point in the history
  • Loading branch information
CachedaCodes committed Oct 9, 2023
1 parent 85fbce8 commit c36acd4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/x-components/src/x-modules/facets/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const clearStickyFilters = filter<XEventPayload<'SearchResponseChanged'>>(
);

/**
* Sets the filters of the facets module from a selectedQueryPreview's filters.
* Sets the filters of the facets module from a queryPreview's filters.
*
* @public
*/
Expand All @@ -166,6 +166,16 @@ export const setSelectedFiltersFromPreview = wireCommit(
({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : [])
);

/**
* Sets the query of the facets module from a queryPreview.
*
* @public
*/
export const setQueryFromPreview = wireCommit(
'setQuery',
({ eventPayload: { query } }) => query
);

/**
* Wiring configuration for the {@link FacetsXModule | facets module}.
*
Expand Down Expand Up @@ -218,6 +228,7 @@ export const facetsWiring = createWiring({
clearStickyFilters
},
UserAcceptedAQueryPreview: {
setQueryFromPreview,
setSelectedFiltersFromPreview
}
});

0 comments on commit c36acd4

Please sign in to comment.