Fixed content unload on reset

This commit is contained in:
benweet 2017-11-21 08:17:41 +00:00
parent 0f9f6b6034
commit 794cd94db6

View File

@ -158,7 +158,13 @@ module.actions.setTemplates = ({ commit }, data) => {
// Last opened // Last opened
module.getters.lastOpened = getter('lastOpened'); module.getters.lastOpened = getter('lastOpened');
module.getters.lastOpenedIds = (state, getters, rootState) => { module.getters.lastOpenedIds = (state, getters, rootState) => {
const lastOpened = getters.lastOpened; const lastOpened = {
...getters.lastOpened,
};
const currentFileId = rootState.file.currentId;
if (currentFileId && !lastOpened[currentFileId]) {
lastOpened[currentFileId] = Date.now();
}
return Object.keys(lastOpened) return Object.keys(lastOpened)
.filter(id => rootState.file.itemMap[id]) .filter(id => rootState.file.itemMap[id])
.sort((id1, id2) => lastOpened[id2] - lastOpened[id1]) .sort((id1, id2) => lastOpened[id2] - lastOpened[id1])