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 {}