An empty live feed is not live data
A server whose marker source is unconfigured answers 200 with an empty array, and the client counted that as success. The deployed map came up with no pins at all, wearing a green "live data" badge — which is the one outcome worse than having no badge, because the badge exists precisely so a fabricated demo cannot be mistaken for real data, and here it was doing the reverse. Empty now falls back to the sample set and keeps saying "sample". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,6 +167,12 @@ export function createTeraClient(options: TeraApiOptions = {}): TeraClient {
|
|||||||
async markers(): Promise<MarkerFeed> {
|
async markers(): Promise<MarkerFeed> {
|
||||||
const body = await get<MarkersBody>("/markers");
|
const body = await get<MarkersBody>("/markers");
|
||||||
if (!body || !Array.isArray(body.markers)) return sampleMarkerFeed();
|
if (!body || !Array.isArray(body.markers)) return sampleMarkerFeed();
|
||||||
|
// An API that answers with nothing is the default posture of a server
|
||||||
|
// whose marker source has not been configured, and it is indistinguishable
|
||||||
|
// to a viewer from a broken map. Fall back, and — more importantly — go on
|
||||||
|
// saying "sample", because the alternative is an empty map wearing a
|
||||||
|
// "live data" badge, which is the one outcome worse than no badge at all.
|
||||||
|
if (body.markers.length === 0) return sampleMarkerFeed();
|
||||||
return {
|
return {
|
||||||
// A `WireMarker` *is* a `Marker` with a provenance field on it, so this
|
// A `WireMarker` *is* a `Marker` with a provenance field on it, so this
|
||||||
// is a widening and not a translation — which is the property
|
// is a widening and not a translation — which is the property
|
||||||
|
|||||||
Reference in New Issue
Block a user