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]);
|
}, [currentPath]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchResults([]);
|
||||||
|
setSearchQuery("");
|
||||||
|
}, [currentPath]);
|
||||||
|
|
||||||
async function loadDir(path: string, pageNum: number) {
|
async function loadDir(path: string, pageNum: number) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
setSearchResults([]);
|
|
||||||
setSearchQuery("");
|
|
||||||
try {
|
try {
|
||||||
const res = await api.listFiles(path, pageNum, LIMIT);
|
const res = await api.listFiles(path, pageNum, LIMIT);
|
||||||
const entries = res.entries ?? [];
|
const entries = res.entries ?? [];
|
||||||
|
|||||||
Reference in New Issue
Block a user