Skip to content

Commit

Permalink
put productId as ?undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
alexprudhomme committed Dec 19, 2024
1 parent 1445716 commit 4e9dfaa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface RecommendationsState {
error: CommerceAPIErrorStatusResponse | null;
isLoading: boolean;
responseId: string;
productId: string;
productId?: string;
}

export interface RecommendationsOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export const recommendationsReducer = createReducer(
return;
}

state[slotId] = buildRecommendationsSlice(
productId ? {productId} : undefined
);
state[slotId] = buildRecommendationsSlice({productId});
})
.addCase(fetchRecommendations.rejected, (state, action) => {
handleError(state, action.meta.arg.slotId, action.payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface RecommendationsSlice {
isLoading: boolean;
responseId: string;
products: Product[];
productId: string;
productId?: string;
}

/**
Expand All @@ -26,5 +26,5 @@ export const getRecommendationsSliceInitialState =
isLoading: false,
responseId: '',
products: [],
productId: '',
productId: undefined,
});

0 comments on commit 4e9dfaa

Please sign in to comment.