Skip to content

Commit 9dd3fec

Browse files
committed
Preserve CID for Download page
1 parent 1f5909a commit 9dd3fec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

console-ui/src/pages/Download/Download.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function Download() {
8282
const activeTab = searchParams.get("tab") || "p2p";
8383

8484
const heliaClientRef = useRef<HeliaClient | null>(null);
85+
const prevNetworkId = useRef(network.id);
8586

8687
// Cleanup on unmount
8788
useEffect(() => {
@@ -90,8 +91,14 @@ export function Download() {
9091
};
9192
}, []);
9293

93-
// Reset everything when network changes
94+
// Reset everything when network actually changes (skip on mount so we
95+
// preserve the CID from URL query params; works with StrictMode)
9496
useEffect(() => {
97+
if (prevNetworkId.current === network.id) {
98+
return;
99+
}
100+
prevNetworkId.current = network.id;
101+
95102
heliaClientRef.current?.stop();
96103
heliaClientRef.current = null;
97104

0 commit comments

Comments
 (0)