Loading client/src/components/History/adapters/HistoryPanelProxy.js +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ export class HistoryPanelProxy { } switchToHistory(historyId) { this.model.id = historyId; store.dispatch("history/setCurrentHistoryId", historyId); store.dispatch("history/setCurrentHistory", historyId); } async buildCollection(collectionType, selection, hideSourceItems, fromRulesInput = false) { let selectionContent = null; Loading client/src/components/providers/UserHistories.js +2 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { "createNewHistory", "updateHistory", "deleteHistory", "setCurrentHistoryId", "setCurrentHistory", "setHistory", "loadHistories", "secureHistory", Loading Loading @@ -73,7 +73,7 @@ export default { setHistory: this.setHistory, // select new history, basically just needs the id setCurrentHistory: (h) => this.setCurrentHistoryId(h.id), setCurrentHistory: (h) => this.setCurrentHistory(h.id), // create new history then select it createNewHistory: this.createNewHistory, Loading client/src/store/historyStore/historyStore.js +14 −23 Original line number Diff line number Diff line Loading @@ -75,11 +75,9 @@ const getters = { }, }; // Holds promises for in-flight loads const promises = { load: null, byId: new Map(), }; // flags to keep track of loading states const isLoadingHistory = new Map(); let isLoadingHistories = false; const actions = { async copyHistory({ dispatch }, { history, name, copyAll }) { Loading @@ -95,7 +93,7 @@ const actions = { const deletedHistory = await deleteHistoryById(history.id, purge); commit("deleteHistory", deletedHistory); if (getters.firstHistoryId) { return dispatch("setCurrentHistoryId", getters.firstHistoryId); return dispatch("setCurrentHistory", getters.firstHistoryId); } else { return dispatch("createNewHistory"); } Loading @@ -104,9 +102,9 @@ const actions = { getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); }, loadHistories({ commit }) { if (!promises.load) { if (!isLoadingHistories) { commit("setHistoriesLoading", true); promises.load = getHistoryList() isLoadingHistories = getHistoryList() .then((list) => { commit("setHistories", list); }) Loading @@ -114,31 +112,24 @@ const actions = { console.warn("loadHistories error", err); }) .finally(() => { promises.load = null; isLoadingHistories = null; commit("setHistoriesLoading", false); }); } }, loadHistoryById({ commit, getters, dispatch }, id) { if (!promises.byId.has(id)) { // immediately set if we have something current const existing = getters.getHistoryById(id); if (existing) { commit("setHistory", existing); } // but also check for updates loadHistoryById({ dispatch }, id) { if (!isLoadingHistory.has(id)) { const p = getHistoryById(id) .then((history) => { dispatch("selectHistory", history); dispatch("setHistory", history); }) .catch((err) => { console.warn("loadHistoryById error", id, err); }) .finally(() => { promises.byId.delete(id); isLoadingHistory.delete(id); }); promises.byId.set(id, p); isLoadingHistory.set(id, p); } }, resetHistory({ commit }) { Loading @@ -153,10 +144,10 @@ const actions = { commit("setHistory", history); commit("setCurrentHistoryId", history.id); }, async setCurrentHistoryId({ dispatch, getters }, id) { async setCurrentHistory({ dispatch, getters }, id) { if (id !== getters.currentHistoryId) { const changedHistory = await setCurrentHistoryOnServer(id); dispatch("loadHistoryById", changedHistory.id); dispatch("selectHistory", changedHistory); } }, setHistory({ commit }, history) { Loading Loading
client/src/components/History/adapters/HistoryPanelProxy.js +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ export class HistoryPanelProxy { } switchToHistory(historyId) { this.model.id = historyId; store.dispatch("history/setCurrentHistoryId", historyId); store.dispatch("history/setCurrentHistory", historyId); } async buildCollection(collectionType, selection, hideSourceItems, fromRulesInput = false) { let selectionContent = null; Loading
client/src/components/providers/UserHistories.js +2 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { "createNewHistory", "updateHistory", "deleteHistory", "setCurrentHistoryId", "setCurrentHistory", "setHistory", "loadHistories", "secureHistory", Loading Loading @@ -73,7 +73,7 @@ export default { setHistory: this.setHistory, // select new history, basically just needs the id setCurrentHistory: (h) => this.setCurrentHistoryId(h.id), setCurrentHistory: (h) => this.setCurrentHistory(h.id), // create new history then select it createNewHistory: this.createNewHistory, Loading
client/src/store/historyStore/historyStore.js +14 −23 Original line number Diff line number Diff line Loading @@ -75,11 +75,9 @@ const getters = { }, }; // Holds promises for in-flight loads const promises = { load: null, byId: new Map(), }; // flags to keep track of loading states const isLoadingHistory = new Map(); let isLoadingHistories = false; const actions = { async copyHistory({ dispatch }, { history, name, copyAll }) { Loading @@ -95,7 +93,7 @@ const actions = { const deletedHistory = await deleteHistoryById(history.id, purge); commit("deleteHistory", deletedHistory); if (getters.firstHistoryId) { return dispatch("setCurrentHistoryId", getters.firstHistoryId); return dispatch("setCurrentHistory", getters.firstHistoryId); } else { return dispatch("createNewHistory"); } Loading @@ -104,9 +102,9 @@ const actions = { getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); }, loadHistories({ commit }) { if (!promises.load) { if (!isLoadingHistories) { commit("setHistoriesLoading", true); promises.load = getHistoryList() isLoadingHistories = getHistoryList() .then((list) => { commit("setHistories", list); }) Loading @@ -114,31 +112,24 @@ const actions = { console.warn("loadHistories error", err); }) .finally(() => { promises.load = null; isLoadingHistories = null; commit("setHistoriesLoading", false); }); } }, loadHistoryById({ commit, getters, dispatch }, id) { if (!promises.byId.has(id)) { // immediately set if we have something current const existing = getters.getHistoryById(id); if (existing) { commit("setHistory", existing); } // but also check for updates loadHistoryById({ dispatch }, id) { if (!isLoadingHistory.has(id)) { const p = getHistoryById(id) .then((history) => { dispatch("selectHistory", history); dispatch("setHistory", history); }) .catch((err) => { console.warn("loadHistoryById error", id, err); }) .finally(() => { promises.byId.delete(id); isLoadingHistory.delete(id); }); promises.byId.set(id, p); isLoadingHistory.set(id, p); } }, resetHistory({ commit }) { Loading @@ -153,10 +144,10 @@ const actions = { commit("setHistory", history); commit("setCurrentHistoryId", history.id); }, async setCurrentHistoryId({ dispatch, getters }, id) { async setCurrentHistory({ dispatch, getters }, id) { if (id !== getters.currentHistoryId) { const changedHistory = await setCurrentHistoryOnServer(id); dispatch("loadHistoryById", changedHistory.id); dispatch("selectHistory", changedHistory); } }, setHistory({ commit }, history) { Loading