Fixes: Document not added to structure
Cache key bump
This commit is contained in:
@@ -3,9 +3,10 @@ import localForage from 'localforage';
|
|||||||
|
|
||||||
class CacheStore {
|
class CacheStore {
|
||||||
key: string;
|
key: string;
|
||||||
|
version: number = 1;
|
||||||
|
|
||||||
cacheKey = (key: string): string => {
|
cacheKey = (key: string): string => {
|
||||||
return `CACHE_${this.key}_${key}`;
|
return `CACHE_${this.key}_${this.version}_${key}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
getItem = (key: string): any => {
|
getItem = (key: string): any => {
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ router.post('documents.update', auth(), async ctx => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update document
|
// Update document
|
||||||
|
const previouslyPublished = !!document.publishedAt;
|
||||||
if (publish) document.publishedAt = new Date();
|
if (publish) document.publishedAt = new Date();
|
||||||
if (title) document.title = title;
|
if (title) document.title = title;
|
||||||
if (text) document.text = text;
|
if (text) document.text = text;
|
||||||
@@ -294,7 +295,7 @@ router.post('documents.update', auth(), async ctx => {
|
|||||||
await document.save();
|
await document.save();
|
||||||
const collection = document.collection;
|
const collection = document.collection;
|
||||||
if (collection.type === 'atlas') {
|
if (collection.type === 'atlas') {
|
||||||
if (document.publishedAt) {
|
if (previouslyPublished) {
|
||||||
await collection.updateDocument(document);
|
await collection.updateDocument(document);
|
||||||
} else if (publish) {
|
} else if (publish) {
|
||||||
await collection.addDocumentToStructure(document);
|
await collection.addDocumentToStructure(document);
|
||||||
|
|||||||
Reference in New Issue
Block a user