add rescan button

This commit is contained in:
2026-05-16 14:39:00 -04:00
parent f23a8a2be6
commit b243266ad3
5 changed files with 157 additions and 39 deletions

View File

@@ -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);
}