From 7d607dbc8f2f5636dd1319ff018add3265c923aa Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 11 Dec 2023 20:41:31 -0800 Subject: Fix store refresh --- modern/src/store/calendars.js | 3 ++- modern/src/store/drivers.js | 3 ++- modern/src/store/groups.js | 3 ++- modern/src/store/maintenances.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'modern/src/store') diff --git a/modern/src/store/calendars.js b/modern/src/store/calendars.js index 924288e6..2d92c004 100644 --- a/modern/src/store/calendars.js +++ b/modern/src/store/calendars.js @@ -6,7 +6,8 @@ const { reducer, actions } = createSlice({ items: {}, }, reducers: { - update(state, action) { + refresh(state, action) { + state.items = {}; action.payload.forEach((item) => state.items[item.id] = item); }, }, diff --git a/modern/src/store/drivers.js b/modern/src/store/drivers.js index 3ebbdd84..d62bd476 100644 --- a/modern/src/store/drivers.js +++ b/modern/src/store/drivers.js @@ -6,7 +6,8 @@ const { reducer, actions } = createSlice({ items: {}, }, reducers: { - update(state, action) { + refresh(state, action) { + state.items = {}; action.payload.forEach((item) => state.items[item.uniqueId] = item); }, }, diff --git a/modern/src/store/groups.js b/modern/src/store/groups.js index 11fc5dbf..607b8609 100644 --- a/modern/src/store/groups.js +++ b/modern/src/store/groups.js @@ -6,7 +6,8 @@ const { reducer, actions } = createSlice({ items: {}, }, reducers: { - update(state, action) { + refresh(state, action) { + state.items = {}; action.payload.forEach((item) => state.items[item.id] = item); }, }, diff --git a/modern/src/store/maintenances.js b/modern/src/store/maintenances.js index 08b2adb6..0f5e41d1 100644 --- a/modern/src/store/maintenances.js +++ b/modern/src/store/maintenances.js @@ -6,7 +6,8 @@ const { reducer, actions } = createSlice({ items: {}, }, reducers: { - update(state, action) { + refresh(state, action) { + state.items = {}; action.payload.forEach((item) => state.items[item.id] = item); }, }, -- cgit v1.2.3