Fix Quick Lead command menu item not appearing (#19635)

- Refactored prefillWorkflowCommandMenuItems and
prefillFrontComponentCommandMenuItems to use
validateBuildAndRunWorkspaceMigration instead of raw TypeORM
createQueryBuilder inserts
- This ensures the flat entity cache is properly updated when seeding
command menu items, fixing the Quick Lead item not appearing after
workspace creation
- Moved command menu item prefill calls outside the transaction since
they now go through the migration pipeline
This commit is contained in:
Raphaël Bosi
2026-04-14 11:30:31 +02:00
committed by GitHub
parent 3e699c4458
commit eb13378760
6 changed files with 223 additions and 113 deletions
@@ -8,6 +8,7 @@ import { STANDARD_OBJECTS } from 'twenty-shared/metadata';
import { FeatureFlagKey, FileFolder } from 'twenty-shared/types';
import { DataSource } from 'typeorm';
import { ApplicationService } from 'src/engine/core-modules/application/application.service';
import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service';
import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
import { FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
@@ -36,6 +37,10 @@ import {
COMPANY_DATA_SEED_COLUMNS,
COMPANY_DATA_SEEDS,
} from 'src/engine/workspace-manager/dev-seeder/data/constants/company-data-seeds.constant';
import {
CONNECTED_ACCOUNT_DATA_SEED_COLUMNS,
CONNECTED_ACCOUNT_DATA_SEEDS,
} from 'src/engine/workspace-manager/dev-seeder/data/constants/connected-account-data-seeds.constant';
import {
DASHBOARD_DATA_SEED_COLUMNS,
getDashboardDataSeeds,
@@ -44,10 +49,6 @@ import {
EMPLOYMENT_HISTORY_DATA_SEED_COLUMNS,
EMPLOYMENT_HISTORY_DATA_SEEDS,
} from 'src/engine/workspace-manager/dev-seeder/data/constants/employment-history-data-seeds.constant';
import {
CONNECTED_ACCOUNT_DATA_SEED_COLUMNS,
CONNECTED_ACCOUNT_DATA_SEEDS,
} from 'src/engine/workspace-manager/dev-seeder/data/constants/connected-account-data-seeds.constant';
import {
MESSAGE_CHANNEL_DATA_SEED_COLUMNS,
MESSAGE_CHANNEL_DATA_SEEDS,
@@ -121,6 +122,7 @@ import { getCreateCompanyWhenAddingNewPersonCodeStepLogicFunctionDefinitions } f
import { prefillWorkflowCommandMenuItems } from 'src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-workflow-command-menu-items.util';
import { prefillWorkflows } from 'src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-workflows.util';
import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications';
import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';
type RecordSeedConfig = {
tableName: string;
@@ -293,6 +295,8 @@ export class DevSeederDataService {
private readonly flatEntityMapsCacheService: WorkspaceManyOrAllFlatEntityMapsCacheService,
private readonly prefillLogicFunctionService: PrefillLogicFunctionService,
private readonly prefillFrontComponentService: PrefillFrontComponentService,
private readonly applicationService: ApplicationService,
private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService,
) {}
public async seed({
@@ -366,12 +370,24 @@ export class DevSeederDataService {
flatObjectMetadataMaps,
flatFieldMetadataMaps,
);
await prefillWorkflowCommandMenuItems(entityManager, workspaceId);
await prefillFrontComponentCommandMenuItems(entityManager, workspaceId);
},
);
await prefillWorkflowCommandMenuItems({
workspaceId,
applicationService: this.applicationService,
flatEntityMapsCacheService: this.flatEntityMapsCacheService,
workspaceMigrationValidateBuildAndRunService:
this.workspaceMigrationValidateBuildAndRunService,
});
await prefillFrontComponentCommandMenuItems({
workspaceId,
applicationService: this.applicationService,
flatEntityMapsCacheService: this.flatEntityMapsCacheService,
workspaceMigrationValidateBuildAndRunService:
this.workspaceMigrationValidateBuildAndRunService,
});
}
private async seedRecordsInBatches({