View becomes blank after deleting select (#6703)
This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-6027](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6027). This ticket was imported from: [TWNTY-6027](https://github.com/twentyhq/twenty/issues/6027) --- ### Description - Delete corresponding view simultaneously once select field is deactivated instead of deleted because the bug happens on the deactivation (one step before deleting), confirmation: <https://discord.com/channels/1130383047699738754/1268662542172028971/1270367244509249651> - Is still possible to create Kanban views with deactivated Select fields, but this is not related to the PR. - The changes on the frontend are for refreshing the data after the view deletion ### Refs #6027 ### Demo <https://www.loom.com/share/4f705344e3054cd5b3d5eadd398d2c9c?sid=8db3d8b9-4dce-4e31-8359-0e31cbc0e2e7> Fixes #6027 --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b1fbf4b683
commit
d61d5857f8
@ -51,6 +51,7 @@ import {
|
||||
} from 'src/engine/metadata-modules/workspace-migration/workspace-migration.entity';
|
||||
import { WorkspaceMigrationFactory } from 'src/engine/metadata-modules/workspace-migration/workspace-migration.factory';
|
||||
import { WorkspaceMigrationService } from 'src/engine/metadata-modules/workspace-migration/workspace-migration.service';
|
||||
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
||||
import { computeObjectTargetTable } from 'src/engine/utils/compute-object-target-table.util';
|
||||
import { WorkspaceMigrationRunnerService } from 'src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service';
|
||||
import { ViewFieldWorkspaceEntity } from 'src/modules/view/standard-objects/view-field.workspace-entity';
|
||||
@ -78,6 +79,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
private readonly dataSourceService: DataSourceService,
|
||||
private readonly typeORMService: TypeORMService,
|
||||
private readonly workspaceMetadataVersionService: WorkspaceMetadataVersionService,
|
||||
private readonly twentyORMGlobalManager: TwentyORMGlobalManager,
|
||||
) {
|
||||
super(fieldMetadataRepository);
|
||||
}
|
||||
@ -348,6 +350,18 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
);
|
||||
}
|
||||
|
||||
if (fieldMetadataInput.isActive === false) {
|
||||
const viewsRepository =
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace(
|
||||
fieldMetadataInput.workspaceId,
|
||||
'view',
|
||||
);
|
||||
|
||||
await viewsRepository.delete({
|
||||
kanbanFieldMetadataId: id,
|
||||
});
|
||||
}
|
||||
|
||||
if (fieldMetadataInput.options) {
|
||||
for (const option of fieldMetadataInput.options) {
|
||||
if (!option.id) {
|
||||
|
||||
Reference in New Issue
Block a user