From eb604cabb6798dba665bcf7df2d52b2279fac9e1 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:14:46 +0200 Subject: [PATCH] Keep current history details on list update The incoming list of histories contains only summary information for all of them and the current history has additional details that we need. Since the current history gets updated regularly, there is no harm in skipping the update from the incoming list. --- client/src/store/historyStore/historyStore.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/store/historyStore/historyStore.js b/client/src/store/historyStore/historyStore.js index 0eb72572f10..eb2c4d83719 100644 --- a/client/src/store/historyStore/historyStore.js +++ b/client/src/store/historyStore/historyStore.js @@ -32,7 +32,14 @@ const mutations = { Vue.delete(state.histories, doomed.id); }, setHistories(state, newHistories = []) { + const currentHistoryId = state.currentHistoryId; + const currentHistory = state.histories[currentHistoryId]; const newMap = newHistories.reduce((acc, h) => ({ ...acc, [h.id]: h }), {}); + if (currentHistory) { + // The incoming history list contains less information than the current history + // so we restore the existing current history since it gets updated regularly anyway + newMap[currentHistoryId] = currentHistory; + } Vue.set(state, "histories", newMap); }, setHistoriesLoading(state, isLoading) {