| 37 | const { permissions } = useAuthenticated(); |
| 38 | |
| 39 | const proxyLatencyLoading = (proxy: TypesGen.Region): boolean => { |
| 40 | if (!refetchDate) { |
| 41 | // Only show loading if the user manually requested a refetch |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | // Only show a loading spinner if: |
| 46 | // - A latency exists. This means the latency was fetched at some point, so |
| 47 | // the loader *should* be resolved. |
| 48 | // - The proxy is healthy. If it is not, the loader might never resolve. |
| 49 | // - The latency reported is older than the refetch date. This means the |
| 50 | // latency is stale and we should show a loading spinner until the new |
| 51 | // latency is fetched. |
| 52 | const latency = latencies[proxy.id]; |
| 53 | return proxy.healthy && latency !== undefined && latency.at < refetchDate; |
| 54 | }; |
| 55 | |
| 56 | // This endpoint returns a 404 when not using enterprise. |
| 57 | // If we don't return null, then it looks like this is |