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(history-queries): selected filters now working for legacy history queries saved in storage without them #1333

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion packages/x-components/src/x-modules/facets/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const setSelectedFiltersFromPreview = wireCommit(
*/
export const setFiltersFromHistoryQueries = wireCommit(
'setFilters',
({ eventPayload: { selectedFilters } }) => selectedFilters
({ eventPayload: { selectedFilters } }) => selectedFilters ?? []
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { HistoryQueriesXStoreModule } from '../types';
// eslint-disable-next-line max-len
export const loadHistoryQueriesFromBrowserStorage: HistoryQueriesXStoreModule['actions']['loadHistoryQueriesFromBrowserStorage'] =
({ commit, getters }) => {
const historyQueries = localStorageService.getItem<HistoryQuery[]>(getters.storageKey) ?? [];
commit('setHistoryQueries', historyQueries);
const historyQueries =
localStorageService.getItem<HistoryQuery[] | HistoryQuery>(getters.storageKey) ?? [];
commit('setHistoryQueries', [historyQueries].flat());
CachedaCodes marked this conversation as resolved.
Show resolved Hide resolved
};
6 changes: 3 additions & 3 deletions packages/x-components/src/x-modules/search/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ export const setSearchSelectedFiltersFromPreview = wireCommit(
*
* @public
*/
export const setSearchSelectedFiltersFromPreviewable = wireCommit(
export const setSearchSelectedFiltersFromHistoryQuery = wireCommit(
'setSelectedFilters',
({ eventPayload: { selectedFilters } }) => selectedFilters
({ eventPayload: { selectedFilters } }) => selectedFilters ?? []
);

/**
Expand Down Expand Up @@ -294,6 +294,6 @@ export const searchWiring = createWiring({
setSearchExtraParams
},
UserSelectedAHistoryQuery: {
setSearchSelectedFiltersFromPreviewable
setSearchSelectedFiltersFromHistoryQuery
}
});