Skip to content

Commit

Permalink
feat: add comments to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed Oct 6, 2023
1 parent 84cb20e commit 5e78ec2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions packages/x-components/src/x-modules/facets/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export const setSelectedFiltersFromPreview = wireCommit(
({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : [])
);

/**
* Sets the filters of the facets module from a selectedHistoryQuery's filters.
*
* @public
*/
export const setSelectedFiltersFromHitoryQueries = wireCommit(
'setFilters',
({ eventPayload: { filters } }) => filters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export interface HistoryQueriesMutations extends QueryMutations {
* @param isEnabled - The new {@link HistoryQueriesState.isEnabled }.
*/
setIsEnabled(isEnabled: boolean): void;

/**
* Sets the {@link HistoryQueriesState.historyQueries.filters } property.
*
* @param filters - The new {@link HistoryQueriesState.historyQueries.filters }.
*/
setSearchSelectedFilters(filters: Filter[]): void;
}
/**
Expand Down
5 changes: 5 additions & 0 deletions packages/x-components/src/x-modules/history-queries/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ export const updateHistoryQueriesWithSearchResponse = wireDispatch(
'updateHistoryQueriesWithSearchResponse'
);

/**
* Sets the history queries state `filters` with a selectedHistoryQuery's filters.
*
* @public
*/
export const setSearchSelectedFilters = wireCommit(
'setSearchSelectedFilters',
({ eventPayload: { filters } }) => filters
Expand Down
8 changes: 1 addition & 7 deletions packages/x-components/src/x-modules/search/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,13 @@ export const setSearchSelectedFiltersFromPreview = wireCommit(
);

/**
* Sets the search state `selectedFilters` with a previewable's filters.
* Sets the search state `selectedFilters` with a selectedHistoryQuery's filters.
*
* @public
*/
export const setSearchSelectedFiltersFromPreviewable = wireCommit(
'setSelectedFilters',
({ eventPayload: { filters } }) => filters
/*({ eventPayload: { facets } }) =>
facets
? (facets as Facet[]).reduce<Filter[]>((filters, facet) => {
return filters.concat(...facet.filters.filter(filter => filter.selected));
}, [])
: []*/
);

/**
Expand Down

0 comments on commit 5e78ec2

Please sign in to comment.