add rescan button
This commit is contained in:
@@ -8,9 +8,11 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function FileBrowser({ libraryId }: Props) {
|
||||
const [currentPath, setCurrentPath] = useState("");
|
||||
const [libraryPaths, setLibraryPaths] = useState<Record<number, string>>({});
|
||||
const [viewingId, setViewingId] = useState<number | null>(null);
|
||||
|
||||
const currentPath = libraryPaths[libraryId] ?? "";
|
||||
|
||||
const { data, isLoading } = useQuery<BrowseResult>({
|
||||
queryKey: ["browse", libraryId, currentPath],
|
||||
queryFn: () => api.libraries.browse(libraryId, currentPath),
|
||||
@@ -19,7 +21,7 @@ export default function FileBrowser({ libraryId }: Props) {
|
||||
const pathParts = currentPath ? currentPath.split("/").filter(Boolean) : [];
|
||||
|
||||
function navigate(relPath: string) {
|
||||
setCurrentPath(relPath);
|
||||
setLibraryPaths((prev) => ({ ...prev, [libraryId]: relPath }));
|
||||
setViewingId(null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user