fix(ui): link every route to its handler, however many files they span (#1975) (#1993)

buildRoutes looked up node ids only for the first 60 distinct handler
files, one getNodesInFile query each, so every later row went out with
handlerId null and the viewer called the handler "not in the index". Load
the nodes of every handler file in one chunked query instead
(getNodesInFiles), which also drops the per-file query the cap existed
to bound.

Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniil
2026-09-27 12:27:31 +00:00
committed by GitHub
co-authored by danusha2345 Claude Opus 5.5
parent 52df4d24ef
commit 6c414cc830
5 changed files with 69 additions and 14 deletions
+18
View File
@@ -959,6 +959,24 @@ export class QueryBuilder {
return rows.map(rowToNode);
}
/**
* Get all nodes in several files at once — one chunked `IN` query rather than
* one {@link getNodesByFile} per file (#1975).
*/
getNodesByFiles(filePaths: readonly string[]): Node[] {
const unique = [...new Set(filePaths)];
const out: Node[] = [];
for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
const placeholders = chunk.map(() => '?').join(',');
const rows = this.db
.prepare(`SELECT * FROM nodes WHERE file_path IN (${placeholders})`)
.all(...chunk) as NodeRow[];
for (const row of rows) out.push(rowToNode(row));
}
return out;
}
/**
* Find the file that holds the densest concentration of the project's
* internal call graph — the "core" file. Used by context-builder to