- {/* v0.11.0 — the same polled snapshot drives the map's plane markers + route lines */}
-
+ {/* v0.11.0 — the same polled snapshot drives the map's plane markers + route lines;
+ ISS-010 (v0.18.0) — applySnapshot lets the airport popup's Relocate row push its
+ action response into the shared state, exactly like RightPane does */}
+
diff --git a/components/Map.tsx b/components/Map.tsx
index e88c89a..be2b8c6 100644
--- a/components/Map.tsx
+++ b/components/Map.tsx
@@ -45,11 +45,14 @@ interface MapProps {
// ISS-002 (v0.15.0): the side panels' hover target — highlights the matching plane
// (+ its route leg if flying) or a package's endpoint airports. Null = nothing hovered.
hovered?: HoverTarget | null;
+ // ISS-010 (v0.18.0): push an action endpoint's full response snapshot into the shared
+ // shell state — same callback RightPane receives, used by the airport popup's Relocate row.
+ applySnapshot: (snapshot: StateSnapshot) => void;
}
// Named FlightMap (not Map): a component called `Map` would shadow the global
// Map constructor inside its own body, breaking `new Map(...)` for the airport index.
-export default function FlightMap({ state, hovered }: MapProps) {
+export default function FlightMap({ state, hovered, applySnapshot }: MapProps) {
const containerRef = useRef(null);
const mapRef = useRef(null);
// /api/airports is fetched at most once per page life: every styledata event
@@ -58,6 +61,12 @@ export default function FlightMap({ state, hovered }: MapProps) {
// Latest snapshot + airport coordinate index, so the mount effect's styledata wiring
// and the state-change effect can both push data without prop-drilling into closures.
const stateRef = useRef(null);
+ // ISS-010 (v0.18.0): the shell's applySnapshot is stable (useCallback with no deps), but the
+ // mount effect captures it once — keep a ref so the popup wiring always calls the latest one.
+ const applySnapshotRef = useRef(applySnapshot);
+ useEffect(() => {
+ applySnapshotRef.current = applySnapshot;
+ }, [applySnapshot]);
const airportsIndexRef = useRef