mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
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.
13 lines
473 B
TypeScript
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)
|
|
}
|