fix: prevent loadDir from clearing search state on every directory load
This commit is contained in:
@@ -81,11 +81,14 @@ export default function Files() {
|
||||
}
|
||||
}, [currentPath]);
|
||||
|
||||
useEffect(() => {
|
||||
setSearchResults([]);
|
||||
setSearchQuery("");
|
||||
}, [currentPath]);
|
||||
|
||||
async function loadDir(path: string, pageNum: number) {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setSearchResults([]);
|
||||
setSearchQuery("");
|
||||
try {
|
||||
const res = await api.listFiles(path, pageNum, LIMIT);
|
||||
const entries = res.entries ?? [];
|
||||
|
||||
Reference in New Issue
Block a user