Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 7a84422

Browse files
staticoclaude
andcommitted
Fix traceroute/position response detection using stale myNodeNum
The packet subscription was capturing processPacketForNodes at mount time when myNodeNum was still 0. Use a ref to always call the latest callback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bae9a8e commit 7a84422

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/ui/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ export function App({ address, packetStore, nodeStore, skipConfig = false }: App
137137
const selectedPacketIndexRef = useRef(selectedPacketIndex);
138138
selectedPacketIndexRef.current = selectedPacketIndex;
139139

140+
// Keep a ref to processPacketForNodes so the subscription always uses the latest
141+
const processPacketRef = useRef(processPacketForNodes);
142+
processPacketRef.current = processPacketForNodes;
143+
140144
useEffect(() => {
141145
const unsubscribe = packetStore.onPacket((packet) => {
142-
processPacketForNodes(packet);
146+
processPacketRef.current(packet);
143147
setPackets((prev) => {
144148
const next = [...prev, packet].slice(-5000);
145149
// Auto-scroll only if exactly at the last packet (not just near it)

0 commit comments

Comments
 (0)