diff --git a/cptr/frontend/src/lib/apis/files.ts b/cptr/frontend/src/lib/apis/files.ts index 0162f66..d29e01a 100644 --- a/cptr/frontend/src/lib/apis/files.ts +++ b/cptr/frontend/src/lib/apis/files.ts @@ -50,15 +50,16 @@ export type FileMatch = { name_match: boolean; content_matches: ContentMatch[]; }; -export type FileMatches = { results: FileMatch[]; truncated: boolean }; +export type FileMatches = { results: FileMatch[]; next_offset: number | null }; export const getFileMatches = ( query: string, path: string, showHidden: boolean, + offset = 0, signal?: AbortSignal ) => fetchJSON( - `/api/workspace/files/matches?query=${encodeURIComponent(query)}&path=${encodeURIComponent(path)}&show_hidden=${showHidden}`, + `/api/workspace/files/matches?query=${encodeURIComponent(query)}&path=${encodeURIComponent(path)}&show_hidden=${showHidden}&offset=${offset}`, { signal } ); diff --git a/cptr/frontend/src/lib/components/FileBrowser.svelte b/cptr/frontend/src/lib/components/FileBrowser.svelte index abf7f07..265fd9c 100644 --- a/cptr/frontend/src/lib/components/FileBrowser.svelte +++ b/cptr/frontend/src/lib/components/FileBrowser.svelte @@ -2,6 +2,7 @@ // Module-level cache: survives component destroy/create cycles const _treeExpandedCache = new Map(); const _treeContentsCache = new Map(); + const _searchQueryCache = new Map();