Skip to content

Commit

Permalink
chore: check if loadedQueryPreview exists
Browse files Browse the repository at this point in the history
  • Loading branch information
annacv committed Nov 27, 2023
1 parent 5d723ae commit 4692d20
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { QueriesPreviewXStoreModule } from '../types';
export const updateQueryPreviewHistory: QueriesPreviewXStoreModule['actions']['updateQueryPreviewHistory'] =
({ commit, state, getters }, request) => {
const { query } = request;
const loadedQueryPreview = getters.loadedQueriesPreview[query].request.query;
const loadedQueryPreview = getters.loadedQueriesPreview[query]?.request?.query ?? undefined;

// If the query preview was already stored, remove the old one.
if (state.queryPreviewHistory.some(item => item === loadedQueryPreview)) {
if (loadedQueryPreview && state.queryPreviewHistory.some(item => item === loadedQueryPreview)) {
commit('clearFromQueryPreviewHistory', query);
}

Expand Down

0 comments on commit 4692d20

Please sign in to comment.