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:
Jarrod Flesch
2025-08-15 14:45:36 -04:00
committed by GitHub
parent 64f4b0aff3
commit 1909063e42

View File

@@ -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)