Files
orca/src/shared/quick-open-listing-limits.ts
T
Jinwoo Hong 74856c83b3 fix(dev): keep Node-only Quick Open path accumulator out of the renderer (#27372)
The renderer imports quick-open-listing-limits for the result cap, but the
same module also held a Buffer-backed accumulator that imports the CommonJS
@orca/process-host dist. Vite dev serves that dist as raw ESM, so the named
import failed and the workspace workbench and right sidebar crashed. Move the
accumulator to its own main-only module.
2026-10-11 00:22:18 -04:00

13 lines
473 B
TypeScript

// Why: the renderer imports this module, so it must stay free of Node-only code.
export const QUICK_OPEN_LISTING_MAX_RESULTS = 20_001
export function resolveQuickOpenResultLimit(requested?: number): number {
if (requested === undefined || requested === Number.POSITIVE_INFINITY) {
return QUICK_OPEN_LISTING_MAX_RESULTS
}
if (!Number.isFinite(requested)) {
return 0
}
return Math.min(Math.max(Math.trunc(requested), 0), QUICK_OPEN_LISTING_MAX_RESULTS)
}