Deleting a collection should detach associated drafts from it (#5082)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -23,7 +23,9 @@ function References({ document }: Props) {
|
||||
}, [documents, document.id]);
|
||||
|
||||
const backlinks = documents.getBacklinkedDocuments(document.id);
|
||||
const collection = collections.get(document.collectionId);
|
||||
const collection = document.collectionId
|
||||
? collections.get(document.collectionId)
|
||||
: undefined;
|
||||
const children = collection
|
||||
? collection.getDocumentChildren(document.id)
|
||||
: [];
|
||||
|
||||
@@ -23,7 +23,9 @@ function DocumentDelete({ document, onSubmit }: Props) {
|
||||
const [isArchiving, setArchiving] = React.useState(false);
|
||||
const { showToast } = useToasts();
|
||||
const canArchive = !document.isDraft && !document.isArchived;
|
||||
const collection = collections.get(document.collectionId);
|
||||
const collection = document.collectionId
|
||||
? collections.get(document.collectionId)
|
||||
: undefined;
|
||||
const nestedDocumentsCount = collection
|
||||
? collection.getDocumentChildren(document.id).length
|
||||
: 0;
|
||||
|
||||
Reference in New Issue
Block a user