diff --git a/frontend/src/_components/OrganizationManager/CreateOrganization.jsx b/frontend/src/_components/OrganizationManager/CreateOrganization.jsx
index 204487773a..6357b000bb 100644
--- a/frontend/src/_components/OrganizationManager/CreateOrganization.jsx
+++ b/frontend/src/_components/OrganizationManager/CreateOrganization.jsx
@@ -19,6 +19,7 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
const darkMode = localStorage.getItem('darkMode') === 'true';
const { t } = useTranslation();
const isSlugSet = useRef(false); // Flag to track if slug has been initially set
+ const sluginput = useRef('');
const createOrganization = () => {
let emptyError = false;
@@ -138,7 +139,7 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
useEffect(() => {
if (!isSlugSet.current && name.value && !slugProgress && !workspaceNameProgress) {
const defaultValue =
- name.value
+ name?.value
.replace(/\s+/g, '')
.toLowerCase()
.replace(/[^a-z0-9-\s]/g, '') || '';
@@ -147,6 +148,7 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
const checkWorkspaceUniqueness = async () => {
try {
await organizationService.checkWorkspaceUniqueness(null, defaultValue);
+ sluginput.current.value = defaultValue;
} catch (errResponse) {
let error = {
status: false,
@@ -160,9 +162,10 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
setSlugProgress(false);
}
if (slugProgress && !isSlugSet.current) {
+ // this is to denote that the user has tried editing the slug -- so now slug and name are independent of each other
isSlugSet.current = true;
}
- }, [name.value, slugProgress, workspaceNameProgress, isSlugSet]);
+ }, [name.value, slug.value, slugProgress, workspaceNameProgress, isSlugSet]);
const isDisabled = isCreating || isNameDisabled || isSlugDisabled || slugProgress || workspaceNameProgress;
@@ -194,6 +197,8 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
+ ) : name.value && !workspaceNameProgress ? (
+
) : (