This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,10 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
143
143
144
144
public focus ( ) {
145
145
this . input . focus ( ) ;
146
+ // programmatic does not fire onFocus handler
147
+ this . setState ( {
148
+ focused : true ,
149
+ } ) ;
146
150
}
147
151
148
152
private onFocus = ( ev ) => {
Original file line number Diff line number Diff line change @@ -214,7 +214,6 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
214
214
} ;
215
215
216
216
const SpaceCreateMenu = ( { onFinished } ) => {
217
- const cli = useContext ( MatrixClientContext ) ;
218
217
const [ visibility , setVisibility ] = useState < Visibility > ( null ) ;
219
218
const [ busy , setBusy ] = useState < boolean > ( false ) ;
220
219
@@ -238,13 +237,9 @@ const SpaceCreateMenu = ({ onFinished }) => {
238
237
return ;
239
238
}
240
239
241
- // validate the space alias field but do not require it
242
- const aliasLocalpart = alias . substring ( 1 , alias . length - cli . getDomain ( ) . length - 1 ) ;
243
- if ( visibility === Visibility . Public && aliasLocalpart &&
244
- ( await spaceAliasField . current . validate ( { allowEmpty : true } ) ) === false
245
- ) {
240
+ if ( visibility === Visibility . Public && ! ( await spaceAliasField . current . validate ( { allowEmpty : false } ) ) ) {
246
241
spaceAliasField . current . focus ( ) ;
247
- spaceAliasField . current . validate ( { allowEmpty : true , focused : true } ) ;
242
+ spaceAliasField . current . validate ( { allowEmpty : false , focused : true } ) ;
248
243
setBusy ( false ) ;
249
244
return ;
250
245
}
@@ -253,7 +248,7 @@ const SpaceCreateMenu = ({ onFinished }) => {
253
248
await createSpace (
254
249
name ,
255
250
visibility === Visibility . Public ,
256
- aliasLocalpart ? alias : undefined ,
251
+ alias ,
257
252
topic ,
258
253
avatar ,
259
254
) ;
You can’t perform that action at this time.
0 commit comments