Skip to content

Commit 4d4e784

Browse files
committedFeb 7, 2025··
chore: apply changes to discard draft
1 parent 6fdadba commit 4d4e784

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎packages/core/core/src/services/document-service/repository.ts

+11
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ export const createContentTypeRepository: RepositoryFactoryMethod = (
391391
oldVersions: oldDrafts,
392392
});
393393

394+
const bidirectionalRelationsToSync = await bidirectionalRelations.load(uid, {
395+
newVersions: versionsToDraft,
396+
oldVersions: oldDrafts,
397+
});
398+
394399
// Delete old drafts
395400
await async.map(oldDrafts, (entry: any) => entries.delete(entry.id));
396401

@@ -406,6 +411,12 @@ export const createContentTypeRepository: RepositoryFactoryMethod = (
406411
relationsToSync
407412
);
408413

414+
await bidirectionalRelations.sync(
415+
[...oldDrafts, ...versionsToDraft],
416+
draftEntries,
417+
bidirectionalRelationsToSync
418+
);
419+
409420
draftEntries.forEach(emitEvent('entry.draft-discard'));
410421
return { documentId, entries: draftEntries };
411422
}

0 commit comments

Comments
 (0)
Please sign in to comment.