feat(peers): updated ipfs-geoip and Peers screen optimizations#2480
Open
feat(peers): updated ipfs-geoip and Peers screen optimizations#2480
Conversation
Member
lidel
commented
Feb 27, 2026
- https://github.com/ipfs-shipyard/ipfs-geoip/releases/tag/v9.3.0
- IPv6 support
- GeoLite2-City-CSV_20260220
- UX optimizations for faster geoip feedback
- peer-locations.js: replace p-memoize getPublicIP with sync ref-cached version, make isPrivateAndNearby/selectPeerLocationsForSwarm/selectPeersCoordinates sync, add in-memory cache to PeerLocationResolver to skip IndexedDB reads, bump poll interval from 1s to 3s, add queue.onIdle() re-fetch trigger - PeersTable.js: remove useState/useEffect async wrapper, consume array directly - WorldMap.js: remove async wrappers from MapPins and PeerInfo, fix resize useEffect missing dependency array - peer-locations.test.js: remove unnecessary await from sync selector calls
- peer-locations.js: replace `isNonHomeIPv4` with `isPublicIP` to accept both protocol 4 (IPv4) and 41 (IPv6), using `ip.isPrivate()` to skip all private/loopback/link-local addresses for both families - peer-locations.js: rename `ipv4Tuple`/`ipv4Addr` to `ipTuple`/`ipAddr` since the filter now matches both IP versions - peer-locations.test.js: add tests for IPv6 peer location resolution, private IPv6/IPv4 `isPrivate` flag, and private IP filtering in `findLocations` - peer-locations.test.js: fix `optimizedPeerSet` IP generation to use only public addresses (old pattern produced 10.x and 127.x)
- peer-locations.js: swap `new Map()` for `HLRU(500)`, matching `failedAddrs` capacity
- guard getPromise against null peers to prevent crash during ramp-up - chain immediate re-fetches during optimizedPeerSet ramp-up (10→100→200→all) instead of waiting 3s staleAfter between each pass - replace onIdle handler with throttled completed event listener so uncached geoip lookups render progressively as they land
- guard null peers with quick 100ms retry instead of waiting 3s staleAfter - shallow-compare new locations with previous data and return the same reference when unchanged, preventing the full selector/render cascade (selectPeerLocationsForSwarm → selectPeersCoordinates → MapPins D3 rebuild)
- WorldMap: use useRef for selectedTimeout instead of useState every mouse leave was calling setSelectedTimeout which re-rendered WorldMap, recreated handleMapPinMouseEnter (selectedTimeout in deps), passed new prop to MapPins, triggering full D3 SVG rebuild. timeout ID is bookkeeping, not display state -- useRef avoids renders. - WorldMap: memoize GeoPath d3 projection with useMemo([width, height]) every mouse hover changed selectedPeers, re-rendered WorldMap, re-rendered GeoPath which created a new d3.geoPath() reference, passed as new prop to MapPins triggering SVG rebuild. now stable unless window is resized. - peer-locations: remove unused selectBootstrapPeers from selectPeerLocationsForSwarm. reselect recomputed the selector (mapping all 298 peers) whenever bootstrap peers changed, even though bootstrapPeers was never referenced in the function body.
react-hooks/exhaustive-deps flagged the `peerLocationsForSwarm || []` expression as unstable dependency for the filteredPeerList useMemo. CI treats warnings as errors, failing the build.
This reverts commit 1de615b.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.