The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix workspace deletion broken (#14188)
Charles Bochet1e9723a6b7d3
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsProtectedRouteWrapper.tsx b/packages/twenty-front/src/modules/settings/components/SettingsProtectedRouteWrapper.tsxindex 7542a85b31d..94cf268d300 100644--- a/packages/twenty-front/src/modules/settings/components/SettingsProtectedRouteWrapper.tsx+++ b/packages/twenty-front/src/modules/settings/components/SettingsProtectedRouteWrapper.tsx@@ -1,3 +1,4 @@+import { useIsLogged } from '@/auth/hooks/useIsLogged';import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';import { SettingsPath } from '@/types/SettingsPath';import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';@@ -20,11 +21,19 @@ export const SettingsProtectedRouteWrapper = ({settingsPermission,requiredFeatureFlag,}: SettingsProtectedRouteWrapperProps) => {+ const isLoggedIn = useIsLogged();const hasPermission = useHasPermissionFlag(settingsPermission);const requiredFeatureFlagEnabled = useIsFeatureEnabled(requiredFeatureFlag || null,);+ if (!isLoggedIn) {+ return null;+ }++ // TODO: this should be part of PageChangeEffect as otherwise we will have multiple sources of redirection that can:+ // - conflict (race conditions)+ // - degrade performance as we will redirect multiple timesif ((requiredFeatureFlag && !requiredFeatureFlagEnabled) || !hasPermission) {return <Navigate to={getSettingsPath(SettingsPath.ProfilePage)} replace />;}diff --git a/packages/twenty-server/src/engine/workspace-datasource/workspace-datasource.service.ts b/packages/twenty-server/src/engine/workspace-datasource/workspace-datasource.service.tsindex ef1fd7a80a6..be1f1f2ab7e 100644--- a/packages/twenty-server/src/engine/workspace-datasource/workspace-datasource.service.ts+++ b/packages/twenty-server/src/engine/workspace-datasource/workspace-datasource.service.ts@@ -58,7 +58,7 @@ export class WorkspaceDataSourceService {const queryRunner = this.coreDataSource.createQueryRunner();- await queryRunner.dropSchema(schemaName, true);+ await queryRunner.dropSchema(schemaName, true, true);await queryRunner.release();}