Skip backfill record page layouts for missing standard objects (#19799)

This commit is contained in:
Weiko 2026-04-17 15:09:11 +02:00 committed by GitHub
parent 68746e22a0
commit 3268a86f4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;