From 9238895c99c30c442ce8dae41b61f898a79dd89b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 20 Sep 2020 23:03:05 -0700 Subject: Handle list refresh --- modern/src/store/devices.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modern/src/store') diff --git a/modern/src/store/devices.js b/modern/src/store/devices.js index 3d7be3e6..66c1607f 100644 --- a/modern/src/store/devices.js +++ b/modern/src/store/devices.js @@ -7,6 +7,10 @@ const { reducer, actions } = createSlice({ selectedId: null }, reducers: { + refresh(state, action) { + state.items = {}; + action.payload.forEach(item => state.items[item['id']] = item); + }, update(state, action) { action.payload.forEach(item => state.items[item['id']] = item); }, -- cgit v1.2.3