Gate the neighbour graph to a region and size labels by busyness

This commit is contained in:
MrAlders0n
2026-07-11 22:11:16 -04:00
parent 991f501f7c
commit 6b0486f3f4
5 changed files with 61 additions and 9 deletions
+2 -1
View File
@@ -7,13 +7,14 @@ const nodeId = (n: NodeSummary) => n.id;
// Page the selected region's nodes 50 at a time for the map, so the canvas fills batch by batch
// instead of waiting for one big response. Thin wrapper over the shared useInfinitePages (which owns
// the auto-chain, dedup, and error handling). Loads once per region; WS updates keep nodes live.
export function useMapNodesData(selectedIatas: string[] | undefined, regionKey: string) {
export function useMapNodesData(selectedIatas: string[] | undefined, regionKey: string, opts?: { enabled?: boolean }) {
const { items, loadedCount, isPaging, isError } = useInfinitePages<NodeSummary>({
queryKey: ["map-nodes", regionKey],
// Always request neighborIds (just UUIDs) so the neighbor-lines toggle is a pure client-side
// render switch over already-loaded data — no refetch when toggling.
queryFn: (cursor) => getNodesPage(selectedIatas, { cursor, neighbors: true }),
getId: nodeId,
enabled: opts?.enabled,
});
return { nodes: items, loadedCount, isPaging, isError };
}