diff --git a/app/stores/CacheStore.js b/app/stores/CacheStore.js index 0c3270d69..8a66a764c 100644 --- a/app/stores/CacheStore.js +++ b/app/stores/CacheStore.js @@ -3,9 +3,10 @@ import localForage from 'localforage'; class CacheStore { key: string; + version: number = 1; cacheKey = (key: string): string => { - return `CACHE_${this.key}_${key}`; + return `CACHE_${this.key}_${this.version}_${key}`; }; getItem = (key: string): any => { diff --git a/server/api/documents.js b/server/api/documents.js index accfede38..8b4a684a1 100644 --- a/server/api/documents.js +++ b/server/api/documents.js @@ -286,6 +286,7 @@ router.post('documents.update', auth(), async ctx => { } // Update document + const previouslyPublished = !!document.publishedAt; if (publish) document.publishedAt = new Date(); if (title) document.title = title; if (text) document.text = text; @@ -294,7 +295,7 @@ router.post('documents.update', auth(), async ctx => { await document.save(); const collection = document.collection; if (collection.type === 'atlas') { - if (document.publishedAt) { + if (previouslyPublished) { await collection.updateDocument(document); } else if (publish) { await collection.addDocumentToStructure(document);