Skip to content

Commit bc1e28a

Browse files
fix: 🐛 browser search not working
1 parent 0c5660a commit bc1e28a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/components/functional/browser/browser.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export function Browser(props: Props) {
9595
const search = usePropagate("");
9696
const { setRoute } = useRoute();
9797

98+
// biome-ignore lint/correctness/useExhaustiveDependencies: Whenever the path changes, we want to clear the search
99+
useEffect(() => {
100+
search.clear();
101+
}, [props.path]);
102+
98103
const [focus, setFocus] = useState<(typeof focusItems)[number]>("key-list");
99104

100105
// const [showRecursive, setShowRecursive] = useState(false);
@@ -136,9 +141,9 @@ export function Browser(props: Props) {
136141
promises.push(redisUtils.getDirectChildGroups());
137142
}
138143
const allEntries = await Promise.all(promises).then((e) => e.flat());
139-
return allEntries.sort((a, b) =>
140-
a.relativePath.localeCompare(b.relativePath),
141-
);
144+
return allEntries
145+
.filter((entry) => entry.baseName.includes(search.propagatedValue))
146+
.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
142147
},
143148
});
144149

0 commit comments

Comments
 (0)