Library: load import folder files on demand, memoize search
The library page passed every importable folder's full file list (up to 5,000 entries each, from the worker's scan) into a client component, though it is only used after clicking Import. With three such folders that was 84% of a 1.3 MB page, re-sent on every refresh after a job finished. - listLocalFolders() returns path, commit and counts only; the Import button fetches one folder's files from GET /api/local-folders?path=… - addModel() checks that an import folder exists without loading its files. - LibraryView builds each model's search text once and memoizes the visible rows and facet counts; the facet sort uses one Intl.Collator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
This commit is contained in:
9 files changed
+110
-31
No files matched your search
@@ -24,10 +24,7 @@ export default async function LibraryPage({ searchParams }: PageProps<"/">) {
|
||||
updates: rows.filter((r) => r.updateAvailable && (r.hubState === "available" || !r.hubState)).length,
|
||||
goneFromHub: rows.filter((r) => r.hubState === "repo_missing" || r.hubState === "commit_missing").length,
|
||||
}}
|
||||
panel={{
|
||||
freeBytes: worker.online ? worker.modelsDirFreeBytes : null,
|
||||
folders: folders.map((f) => ({ path: f.path, commit: f.commit, files: f.files, fileCount: f.fileCount, totalBytes: f.totalBytes })),
|
||||
}}
|
||||
panel={{ freeBytes: worker.online ? worker.modelsDirFreeBytes : null, folders }}
|
||||
/>
|
||||
{rows.length > 0 && <LibraryView rows={rows} />}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user