Remove deleted articles from the category list cache.
After DELETE, the category view kept showing the article until a full reload because Redux still held it.
This commit is contained in:
@@ -217,6 +217,12 @@ const categorySlice = createSlice({
|
||||
resetCategoryState() {
|
||||
return initialState;
|
||||
},
|
||||
removeArticleBySku(state, action) {
|
||||
const sku = action.payload;
|
||||
state.articles = state.articles.filter((row) => row.sku !== sku);
|
||||
state.articlesTotal = state.articles.length;
|
||||
state.rootArticles = state.rootArticles.filter((row) => row.sku !== sku);
|
||||
},
|
||||
},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
@@ -298,6 +304,7 @@ export const {
|
||||
navigateToCategory,
|
||||
navigateBack,
|
||||
resetCategoryState,
|
||||
removeArticleBySku,
|
||||
} = categorySlice.actions;
|
||||
|
||||
export const selectCategoryMap = (state) => state.category.categories;
|
||||
|
||||
Reference in New Issue
Block a user