From b663cc401101386785ff6461f7f4a2ada4c40fe7 Mon Sep 17 00:00:00 2001 From: Saloni Gupta Date: Wed, 21 Aug 2024 16:04:57 -0700 Subject: [PATCH] fix: fix error toast popping up in Workpace Creator view --- webui/react/src/components/WorkspaceCreateModal.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/webui/react/src/components/WorkspaceCreateModal.tsx b/webui/react/src/components/WorkspaceCreateModal.tsx index 43699454381..1ead30c78fa 100644 --- a/webui/react/src/components/WorkspaceCreateModal.tsx +++ b/webui/react/src/components/WorkspaceCreateModal.tsx @@ -76,7 +76,11 @@ const WorkspaceCreateModalComponent: React.FC = ({ onClose, workspaceId } const resourceManagers = Loadable.getOrElse([], loadableResourceManagers); const namespaceBindingsList = useAsync( async (canceller) => { - if (workspaceId === undefined || resourceManagers.length === 0) { + if ( + workspaceId === undefined || + resourceManagers.length === 0 || + !canSetWorkspaceNamespaceBindings + ) { return NotLoaded; } try { @@ -95,11 +99,11 @@ const WorkspaceCreateModalComponent: React.FC = ({ onClose, workspaceId } return NotLoaded; } }, - [resourceManagers, workspaceId], + [canSetWorkspaceNamespaceBindings, resourceManagers, workspaceId], ); const resourceQuotasList = useAsync( async (canceller) => { - if (workspaceId === undefined || resourceManagers.length === 0) { + if (workspaceId === undefined || resourceManagers.length === 0 || !canViewResourceQuotas) { return NotLoaded; } try { @@ -118,7 +122,7 @@ const WorkspaceCreateModalComponent: React.FC = ({ onClose, workspaceId } return NotLoaded; } }, - [resourceManagers, workspaceId], + [canViewResourceQuotas, resourceManagers, workspaceId], ); const initFields = useCallback(