mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site/src/pages/TemplateBuilder): allow TemplateCard to be selected if it has no variables (#27031)
Fixes a bug where if `base.variables` is not defined, clicking a `TemplateCard` fails (no base template gets selected) and this error gets logged: ``` Uncaught TypeError: Cannot read properties of undefined (reading 'length') ``` <img width="1840" height="1191" alt="image" src="https://github.com/user-attachments/assets/b51a1f05-ab58-4b17-a126-350604f9832b" />
This commit is contained in:
@@ -23,7 +23,7 @@ function toSelectedBaseMeta(base: TemplateBuilderBase): SelectedBaseMeta {
|
||||
iconUrl: base.icon,
|
||||
os: base.os,
|
||||
hasParameters:
|
||||
base.variables.length > 0 && base.variables.some((v) => !v.sensitive),
|
||||
base.variables?.length > 0 && base.variables?.some((v) => !v.sensitive),
|
||||
hasPrerequisites: Boolean(base.prerequisites?.length),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user