Skip to content

Commit 4309e6a

Browse files
committed
update
1 parent 7e0a90e commit 4309e6a

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/features/feeds/components/FeedList.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,34 @@ export const FeedList = ({
6767
}
6868
}, [currentNetwork, isStreams])
6969

70+
// Force initial sync with URL
71+
useEffect(() => {
72+
// Get the latest network from URL
73+
const latestNetworkFromURL = getNetworkFromURL()
74+
if (latestNetworkFromURL !== currentNetwork) {
75+
setCurrentNetwork(latestNetworkFromURL)
76+
}
77+
78+
// Force a redraw after a short delay
79+
if (typeof window !== "undefined") {
80+
// execute after the DOM is fully loaded
81+
window.addEventListener("load", () => {
82+
const networkFromURL = getNetworkFromURL()
83+
setCurrentNetwork(networkFromURL)
84+
85+
// Force a repaint of aria-selected attributes
86+
document.querySelectorAll(".network-button").forEach((button) => {
87+
const buttonId = button.getAttribute("id")
88+
if (buttonId === networkFromURL) {
89+
button.setAttribute("aria-selected", "true")
90+
} else {
91+
button.setAttribute("aria-selected", "false")
92+
}
93+
})
94+
})
95+
}
96+
}, [])
97+
7098
// Regular query string states
7199
const [searchValue, setSearchValue] = useQueryString("search", "")
72100
const [testnetSearchValue, setTestnetSearchValue] = useQueryString("testnetSearch", "")
@@ -135,7 +163,7 @@ export const FeedList = ({
135163
// Use scrollIntoView with behavior: auto to ensure proper positioning
136164
targetElement.scrollIntoView({ behavior: "auto" })
137165
}
138-
}, 100)
166+
}, 200)
139167
}
140168
}, [chainMetadata.loading, chainMetadata.processedData])
141169

0 commit comments

Comments
 (0)