mirror of
https://github.com/MeshCore-Beacon/beacon-web.git
synced 2026-09-17 02:34:18 +00:00
Gate the neighbour graph to a region and size labels by busyness
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user