From 68e2d81c8c05328c6e34b949239c58c429d3c1e3 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 18 Sep 2026 11:48:57 -0400 Subject: [PATCH] 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) --- ui/src/views/Forecast.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/src/views/Forecast.jsx b/ui/src/views/Forecast.jsx index 3618c8f..0510d42 100644 --- a/ui/src/views/Forecast.jsx +++ b/ui/src/views/Forecast.jsx @@ -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 {}