Files
Shadowbroker/frontend/src/components/map/featureIds.ts
T
C3B2W23andClaude Fable 5.1 f95b0eccc5 fix(map): keep tracked aircraft and yacht labels in step with data filters
Tracked-flight and tracked-yacht HTML labels are rendered from the raw
store arrays, while their icons come from the worker GeoJSON that already
has the operator's data filters applied. Filtering Tracked Aircraft to a
category therefore removed the icons but left every other aircraft's name
on the map.

Derive the label subjects from the ids in the filtered feature collection
so a label is only drawn where an icon is. The id rule lives in one shared
helper used by both the worker builders and the label selector; rows with
no identifier keep the worker's positional fallback and draw no label.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 14:57:09 -07:00

19 lines
655 B
TypeScript

import type { Ship } from '@/types/dashboard';
/**
* Feature ids shared by the worker that builds map icons and the main-thread
* code that picks label subjects, so both sides agree on which record a
* feature represents. Records with no identifier get the worker's positional
* fallback, which cannot be matched from outside and so draw no label.
*/
export function trackedFlightFeatureId(
f: { icao24?: string; callsign?: string },
fallback = '',
): string {
return f.icao24 || f.callsign || fallback;
}
export function shipFeatureId(s: Pick<Ship, 'mmsi' | 'name'>, fallback = ''): string {
return String(s.mmsi || s.name || fallback);
}