fix: Collection with only draft shows empty state, closes #3119
This commit is contained in:
@@ -66,7 +66,10 @@ export default class Collection extends BaseModel {
|
||||
|
||||
@computed
|
||||
get isEmpty(): boolean {
|
||||
return this.documents.length === 0;
|
||||
return (
|
||||
this.documents.length === 0 &&
|
||||
this.store.rootStore.documents.inCollection(this.id).length === 0
|
||||
);
|
||||
}
|
||||
|
||||
@computed
|
||||
|
||||
@@ -142,7 +142,12 @@ export default class DocumentsStore extends BaseStore<Document> {
|
||||
return [];
|
||||
}
|
||||
|
||||
return compact(collection.documents.map((node) => this.get(node.id)));
|
||||
const drafts = this.drafts({ collectionId });
|
||||
|
||||
return compact([
|
||||
...drafts,
|
||||
...collection.documents.map((node) => this.get(node.id)),
|
||||
]);
|
||||
}
|
||||
|
||||
leastRecentlyUpdatedInCollection(collectionId: string): Document[] {
|
||||
|
||||
Reference in New Issue
Block a user