diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx index ee7bc7e2e5750..94957030ebc65 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx @@ -135,6 +135,10 @@ export const CreateWorkspacePageView: FC< }) const isLoading = props.loadingTemplateSchema || props.loadingTemplates + // We only want to show schema that have redisplay_value equals true + const schemaToBeDisplayed = props.templateSchema?.filter( + (schema) => schema.redisplay_value, + ) const getFieldHelpers = getFormHelpers( form, @@ -271,29 +275,26 @@ export const CreateWorkspacePageView: FC< )} {/* Template params */} - {props.templateSchema && props.templateSchema.length > 0 && ( + {schemaToBeDisplayed && schemaToBeDisplayed.length > 0 && ( - {props.templateSchema - // We only want to show schema that have redisplay_value equals true - .filter((schema) => schema.redisplay_value) - .map((schema) => ( - { - setParameterValues({ - ...parameterValues, - [schema.name]: value, - }) - }} - schema={schema} - /> - ))} + {schemaToBeDisplayed.map((schema) => ( + { + setParameterValues({ + ...parameterValues, + [schema.name]: value, + }) + }} + schema={schema} + /> + ))} )}