Let an empty result be an answer, not an abort
worker.table([], { index: 'pf_gkey' }) aborts: an empty array carries no
columns, so the index names one that does not exist and the page dies with
"Specified index `pf_gkey` does not exist in dataset" instead of saying it
found nothing.
Nothing is a legitimate answer -- an empty version, and now a territory with
no rows in it, which is what surfaced this. The empty table is built without
an index and the page says which of the two it is.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e94c364406
commit
68e2d81c8c
@ -777,8 +777,18 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
|
||||
if (stale) await stale.delete()
|
||||
} catch {}
|
||||
|
||||
const opts = { name: tableName, index: indexCol }
|
||||
// An empty result gets no index. `[]` carries no columns, so naming one
|
||||
// aborts the worker outright -- "Specified index `pf_gkey` does not exist
|
||||
// in dataset" -- and the page dies rather than saying it found nothing.
|
||||
// Nothing is a legitimate answer: an empty version, or a territory with no
|
||||
// rows in it.
|
||||
const opts = rowCount > 0
|
||||
? { name: tableName, index: indexCol }
|
||||
: { name: tableName }
|
||||
tableRef.current = await (rowCount > 0 ? worker.table(buffer, opts) : worker.table([], opts))
|
||||
if (rowCount === 0) {
|
||||
flash('No rows to show — the version is empty, or none of it is in your territory', 'error')
|
||||
}
|
||||
|
||||
if (myId !== initIdRef.current) {
|
||||
try { await tableRef.current.delete() } catch {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user