Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set query in facets module from selecting a query preview #1318

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 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,13 @@ 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 +225,7 @@ export const facetsWiring = createWiring({
clearStickyFilters
},
UserAcceptedAQueryPreview: {
setQueryFromPreview,
setSelectedFiltersFromPreview
}
});