Skip to content

Commit 303e59d

Browse files
mcintyre94claude
andauthored
Fix search not displaying when no tags exist (#32)
Previously the TagFilters component returned null when there were no tags, hiding both the search input and tag filtering controls. Now search is always displayed, and only the tag filtering toggle/badges are hidden when no tags exist. Fixes #10 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 568bc94 commit 303e59d

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

entrypoints/sidepanel/components/TagFilters.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,31 @@ export default function TagFilters({ tags, filtersEnabled, searchQuery, fetcher
7676
};
7777
}, []);
7878

79-
if (tags.length === 0) return null;
79+
const hasTags = tags.length > 0;
8080

8181
return (
8282
<Box>
8383
<fetcher.Form action="/filtered-accounts">
8484
<Stack gap="md" align="flex-start">
8585
<Group gap="sm" align="center" wrap="nowrap" style={{ width: '100%' }}>
86-
<Switch
87-
withThumbIndicator={false}
88-
labelPosition="left"
89-
label="Enable tag filtering"
90-
size="md"
91-
name='enableFilters'
92-
id='enableFilters'
93-
value='enabled'
94-
defaultChecked={filtersEnabled}
95-
color="blue.5"
96-
styles={{
97-
label: { whiteSpace: 'pre-wrap', maxWidth: '120px' },
98-
body: { alignItems: 'center' },
99-
}}
100-
onChange={handleNonSearchChange}
101-
/>
86+
{hasTags && (
87+
<Switch
88+
withThumbIndicator={false}
89+
labelPosition="left"
90+
label="Enable tag filtering"
91+
size="md"
92+
name='enableFilters'
93+
id='enableFilters'
94+
value='enabled'
95+
defaultChecked={filtersEnabled}
96+
color="blue.5"
97+
styles={{
98+
label: { whiteSpace: 'pre-wrap', maxWidth: '120px' },
99+
body: { alignItems: 'center' },
100+
}}
101+
onChange={handleNonSearchChange}
102+
/>
103+
)}
102104

103105
<TextInput
104106
type='search'
@@ -117,7 +119,7 @@ export default function TagFilters({ tags, filtersEnabled, searchQuery, fetcher
117119
}}
118120
/>
119121
</Group>
120-
{filtersEnabled ?
122+
{filtersEnabled && hasTags && (
121123
<Group gap="xs">
122124
{tags.map(tag =>
123125
<TagCheckbox
@@ -130,8 +132,7 @@ export default function TagFilters({ tags, filtersEnabled, searchQuery, fetcher
130132
>{tag.tagName}</TagCheckbox>
131133
)}
132134
</Group>
133-
: null
134-
}
135+
)}
135136
</Stack>
136137
</fetcher.Form>
137138
</Box>

0 commit comments

Comments
 (0)