diff --git a/.changeset/heavy-ducks-raise.md b/.changeset/heavy-ducks-raise.md new file mode 100644 index 0000000000..71a16da512 --- /dev/null +++ b/.changeset/heavy-ducks-raise.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Ignore relations when comparing entities. This stops the refresh loop from rewriting entities over and over. diff --git a/packages/catalog-model/src/entity/util.ts b/packages/catalog-model/src/entity/util.ts index 2a196a65d8..ed68339a99 100644 --- a/packages/catalog-model/src/entity/util.ts +++ b/packages/catalog-model/src/entity/util.ts @@ -46,6 +46,10 @@ export function generateEntityEtag(): string { * are added or existing annotations were changed (since they are effectively * merged when doing updates). * + * Note that this comparison does NOT take state, relations or similar into + * account. It only compares the actual input entity data, i.e. metadata and + * spec. + * * @param previous The old state of the entity * @param next The new state of the entity */ @@ -76,6 +80,10 @@ export function entityHasChanges(previous: Entity, next: Entity): boolean { delete e1.metadata.annotations; delete e2.metadata.annotations; + // Remove things that we explicitly do not compare + delete e1.relations; + delete e2.relations; + return !lodash.isEqual(e1, e2); }