diff --git a/ui/src/views/Forecast.jsx b/ui/src/views/Forecast.jsx index 30815c1..6b726e1 100644 --- a/ui/src/views/Forecast.jsx +++ b/ui/src/views/Forecast.jsx @@ -1080,15 +1080,20 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio const meta = colMetaRef.current.find(c => c.cname === col) const group = meta?.dim_group && dimMembers[meta.dim_group] - // With the member list in hand this is a local lookup. It also answers where - // the source query could not: the source holds every attribute set a part ever - // had, so anything with more than one came back ambiguous and filled nothing. - // A member row is a single definition by construction. - let derived = null - if (group) { - derived = group.members.find(m => m.key_value === value.trim())?.attrs || null - if (!derived) return - } else { + // With the member list in hand this is a local lookup, and it answers where the + // source query could not: the source holds every attribute set a part ever had, + // so anything with more than one came back ambiguous and filled nothing. A + // member row is a single definition by construction. + // + // A miss is not an answer though. The list can be empty (never refreshed, or a + // refresh still running) or simply not contain this key, and in either case the + // source still knows. Falling back costs one request on a path that only runs + // when someone types a value. + let derived = group?.members?.length + ? (group.members.find(m => m.key_value === value.trim())?.attrs || null) + : null + + if (!derived) { const res = await fetch(`/api/sources/${sourceId}/lookup?col=${encodeURIComponent(col)}&value=${encodeURIComponent(value)}`) if (!res.ok) return derived = await res.json()