Fix dev seed page layout cache invalidation (#17141)

# Introduction

followup https://github.com/twentyhq/twenty/pull/16962

Root cause: as now the twenty standard app installation in seeded
workspace invalidates and set the page layout-xxx caches the inserted
through direct repo access data in the prefill legacy page layout
methods do not interact with the cache
The cache being set in prior when recompute does not result in db
introspection as before as when was unset
This commit is contained in:
Paul Rastoin
2026-01-14 13:08:51 +01:00
committed by GitHub
parent d95ff4e252
commit 70704264ac
@@ -2,11 +2,14 @@ import { Injectable } from '@nestjs/common';
import { InjectDataSource } from '@nestjs/typeorm';
import { DataSource } from 'typeorm';
import { ALL_METADATA_NAME } from 'twenty-shared/metadata';
import { ApplicationService } from 'src/engine/core-modules/application/application.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
import { getMetadataFlatEntityMapsKey } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-flat-entity-maps-key.util';
import { getMetadataRelatedMetadataNames } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-related-metadata-names.util';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service';
import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';
@@ -125,6 +128,17 @@ export class DevSeederService {
workspaceCustomApplicationId: workspaceCustomFlatApplication.id,
});
const relatedPageLayoutCacheKeysToInvalidate = [
...getMetadataRelatedMetadataNames(ALL_METADATA_NAME.pageLayout),
...getMetadataRelatedMetadataNames(ALL_METADATA_NAME.pageLayoutTab),
...getMetadataRelatedMetadataNames(ALL_METADATA_NAME.pageLayoutWidget),
].map(getMetadataFlatEntityMapsKey);
await this.workspaceCacheService.invalidateAndRecompute(
workspaceId,
relatedPageLayoutCacheKeysToInvalidate,
);
await this.devSeederDataService.seed({
schemaName: dataSourceMetadata.schema,
workspaceId,