Skip to content

Commit 9bf3b35

Browse files
authored
fix: update create workspace button to recognize template names+display names (#10233)
* fix: only used 'unnamed' as a last resort for templates * fix: update filter logic to read from name field
1 parent 6ef1bee commit 9bf3b35

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

site/src/pages/WorkspacesPage/WorkspacesButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ function sortTemplatesByUsersDesc(
3737

3838
const termMatcher = new RegExp(searchTerm.replaceAll(/[^\w]/g, "."), "i");
3939
return templates
40-
.filter((template) => termMatcher.test(template.display_name))
40+
.filter(
41+
(template) =>
42+
termMatcher.test(template.display_name) ||
43+
termMatcher.test(template.name),
44+
)
4145
.sort((t1, t2) => t2.active_user_count - t1.active_user_count)
4246
.slice(0, 10);
4347
}
@@ -84,7 +88,7 @@ function WorkspaceResultsRow({ template }: { template: Template }) {
8488
sx={{ marginY: 0, paddingBottom: 0.5, lineHeight: 1 }}
8589
noWrap
8690
>
87-
{template.display_name || "[Unnamed]"}
91+
{template.display_name || template.name || "[Unnamed]"}
8892
</Typography>
8993

9094
<Box

0 commit comments

Comments
 (0)