File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
site/src/pages/TemplatePage/TemplateEmbedPage Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ function getClipboardCopyContent(
63
63
return `[](${ buttonUrl } )` ;
64
64
}
65
65
66
+ const workspaceNameValidator = nameValidator ( "Workspace name" ) ;
67
+
66
68
export const TemplateEmbedPageView : FC < TemplateEmbedPageViewProps > = ( {
67
69
template,
68
70
templateParameters,
@@ -93,13 +95,16 @@ export const TemplateEmbedPageView: FC<TemplateEmbedPageViewProps> = ({
93
95
} , [ buttonValues , templateParameters ] ) ;
94
96
95
97
const [ workspaceNameError , setWorkspaceNameError ] = useState ( "" ) ;
96
- const workspaceNameValidator = nameValidator ( "Workspace name" ) ;
97
98
const validateWorkspaceName = ( workspaceName : string ) => {
98
99
try {
99
- workspaceName && workspaceNameValidator . validateSync ( workspaceName ) ;
100
+ if ( workspaceName ) {
101
+ workspaceNameValidator . validateSync ( workspaceName ) ;
102
+ }
100
103
setWorkspaceNameError ( "" ) ;
101
104
} catch ( e ) {
102
- setWorkspaceNameError ( e instanceof ValidationError ? e . message : "" ) ;
105
+ if ( e instanceof ValidationError ) {
106
+ setWorkspaceNameError ( e . message ) ;
107
+ }
103
108
}
104
109
} ;
105
110
You can’t perform that action at this time.
0 commit comments