mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix creating new relation when applying snapshot diff (#18879)
* Fix creating new relation when applying snapshot diff (#18692) * Update apply-diff.ts Collection and field might not be part of the dif but are mandatory * Update contributors.yml * Update apply-diff.ts * prettier * Add changeset --------- Co-authored-by: gkielwasser <gkielwasser@gmail.com>
This commit is contained in:
5
.changeset/happy-jeans-care.md
Normal file
5
.changeset/happy-jeans-care.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/api': patch
|
||||
---
|
||||
|
||||
Fixed a problem that could cause snapshot apply to fail when a relationship changed
|
||||
@@ -275,7 +275,14 @@ export async function applyDiff(
|
||||
|
||||
if (diff?.[0]?.kind === DiffKind.NEW) {
|
||||
try {
|
||||
await relationsService.createOne((diff[0] as DiffNew<Relation>).rhs, mutationOptions);
|
||||
await relationsService.createOne(
|
||||
{
|
||||
...(diff[0] as DiffNew<Relation>).rhs,
|
||||
collection,
|
||||
field,
|
||||
},
|
||||
mutationOptions
|
||||
);
|
||||
} catch (err) {
|
||||
logger.error(`Failed to create relation "${collection}.${field}"`);
|
||||
throw err;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
- ChuckMoe
|
||||
- groksrc
|
||||
- timio23
|
||||
- gkielwasser
|
||||
- craigharman
|
||||
- acautin
|
||||
- ninogjoni
|
||||
|
||||
Reference in New Issue
Block a user