mirror of
https://github.com/directus/directus.git
synced 2026-01-22 12:28:01 -05:00
Add extra type check in apply-diff (#18783)
This commit is contained in:
5
.changeset/nine-masks-explode.md
Normal file
5
.changeset/nine-masks-explode.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@directus/api": patch
|
||||
---
|
||||
|
||||
Added extra type check in apply-diff
|
||||
@@ -181,9 +181,11 @@ export async function applyDiff(
|
||||
|
||||
// delete top level collections (no group) first, then continue with nested collections recursively
|
||||
await deleteCollections(
|
||||
snapshotDiff.collections.filter(
|
||||
({ diff }) => diff[0]?.kind === DiffKind.DELETE && (diff[0] as DiffDeleted<Collection>).lhs.meta?.group === null
|
||||
)
|
||||
snapshotDiff.collections.filter(({ diff }) => {
|
||||
if (diff.length === 0 || diff[0] === undefined) return false;
|
||||
const collectionDiff = diff[0] as DiffDeleted<Collection>;
|
||||
return collectionDiff.kind === DiffKind.DELETE && collectionDiff.lhs?.meta?.group === null;
|
||||
})
|
||||
);
|
||||
|
||||
for (const { collection, diff } of snapshotDiff.collections) {
|
||||
|
||||
Reference in New Issue
Block a user