Skip to content

Commit d757529

Browse files
committed
rename
1 parent ed4aebf commit d757529

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

site/src/contexts/useProxyLatency.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ export const useProxyLatency = (
4242
{},
4343
)
4444

45-
// This fetchNumber is used to trigger a refetch of the proxy latencies.
46-
const [fetchNumber, setFetchNumber] = useState(0)
47-
const refetch = (): void => {
48-
setFetchNumber(fetchNumber + 1)
45+
// This latestFetchRequest is used to trigger a refetch of the proxy latencies.
46+
const [latestFetchRequest, setLatestFetchRequest] = useState(new Date().toISOString())
47+
const refetch = () => {
48+
setLatestFetchRequest(new Date().toISOString())
4949
}
5050

51+
5152
// Only run latency updates when the proxies change.
5253
useEffect(() => {
5354
if (!proxies) {
@@ -157,7 +158,7 @@ export const useProxyLatency = (
157158
// via the performance observer. So we can disconnect the observer.
158159
observer.disconnect()
159160
})
160-
}, [proxies, fetchNumber])
161+
}, [proxies, latestFetchRequest])
161162

162163
return {
163164
proxyLatencies,

0 commit comments

Comments
 (0)