Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix create subspace dialog not working (#10652)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Apr 18, 2023
1 parent 83359f8 commit 0db40e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/views/dialogs/CreateSubspaceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,22 @@ const CreateSubspaceDialog: React.FC<IProps> = ({ space, onAddExistingSpaceClick

const onCreateSubspaceClick = async (e: ButtonEvent): Promise<void> => {
e.preventDefault();
if (busy || !spaceNameField.current || !spaceAliasField.current) return;
if (busy) return;

setBusy(true);
// require & validate the space name field
if (!(await spaceNameField.current.validate({ allowEmpty: false }))) {
if (spaceNameField.current && !(await spaceNameField.current.validate({ allowEmpty: false }))) {
spaceNameField.current.focus();
spaceNameField.current.validate({ allowEmpty: false, focused: true });
setBusy(false);
return;
}
// validate the space name alias field but do not require it
if (joinRule === JoinRule.Public && !(await spaceAliasField.current.validate({ allowEmpty: true }))) {
if (
spaceAliasField.current &&
joinRule === JoinRule.Public &&
(await spaceAliasField.current.validate({ allowEmpty: true }))
) {
spaceAliasField.current.focus();
spaceAliasField.current.validate({ allowEmpty: true, focused: true });
setBusy(false);
Expand Down

0 comments on commit 0db40e3

Please sign in to comment.