mirror of
https://github.com/twentyhq/twenty
synced 2026-04-21 13:37:22 +00:00
Skip backfill record page layouts for missing standard objects (#19799)
This commit is contained in:
parent
68746e22a0
commit
3268a86f4b
1 changed files with 33 additions and 0 deletions
|
|
@ -245,6 +245,17 @@ export class BackfillRecordPageLayoutsCommand extends ActiveOrSuspendedWorkspace
|
|||
twentyStandardApplicationId: twentyStandardFlatApplication.id,
|
||||
});
|
||||
|
||||
const { flatObjectMetadataMaps } =
|
||||
await this.workspaceCacheService.getOrRecompute(workspaceId, [
|
||||
'flatObjectMetadataMaps',
|
||||
]);
|
||||
|
||||
const existingObjectMetadataUniversalIdentifiers = new Set(
|
||||
Object.values(flatObjectMetadataMaps.byUniversalIdentifier)
|
||||
.filter(isDefined)
|
||||
.map((objectMetadata) => objectMetadata.universalIdentifier),
|
||||
);
|
||||
|
||||
const recordPageLayoutUniversalIdentifiers = new Set<string>();
|
||||
|
||||
const pageLayouts = Object.values(
|
||||
|
|
@ -256,6 +267,19 @@ export class BackfillRecordPageLayoutsCommand extends ActiveOrSuspendedWorkspace
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
isDefined(pageLayout.objectMetadataUniversalIdentifier) &&
|
||||
!existingObjectMetadataUniversalIdentifiers.has(
|
||||
pageLayout.objectMetadataUniversalIdentifier,
|
||||
)
|
||||
) {
|
||||
this.logger.log(
|
||||
`Skipping standard record page layout ${pageLayout.universalIdentifier} for workspace ${workspaceId}: associated object ${pageLayout.objectMetadataUniversalIdentifier} does not exist`,
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
recordPageLayoutUniversalIdentifiers.add(
|
||||
pageLayout.universalIdentifier,
|
||||
);
|
||||
|
|
@ -300,6 +324,15 @@ export class BackfillRecordPageLayoutsCommand extends ActiveOrSuspendedWorkspace
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
isDefined(view.objectMetadataUniversalIdentifier) &&
|
||||
!existingObjectMetadataUniversalIdentifiers.has(
|
||||
view.objectMetadataUniversalIdentifier,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fieldsWidgetViewUniversalIdentifiers.add(view.universalIdentifier);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue