fix: omit trashed documents from appearing in folder results (#13492)
### Issue The folders join field query was returning trashed documents. ### Fix Adds a constraint to trash enabled collections, which prevents trashed documents from being surfaced in folder views.
This commit is contained in:
@@ -51,6 +51,15 @@ export async function buildFolderWhereConstraints({
|
|||||||
equals: collectionConfig.slug,
|
equals: collectionConfig.slug,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// join queries need to omit trashed documents
|
||||||
|
if (collectionConfig.trash) {
|
||||||
|
constraints.push({
|
||||||
|
deletedAt: {
|
||||||
|
exists: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredConstraints = constraints.filter(Boolean)
|
const filteredConstraints = constraints.filter(Boolean)
|
||||||
|
|||||||
Reference in New Issue
Block a user