Skip to content

Commit 49042b7

Browse files
authored
Upgrade to react 18 - Fix connection issues (#435)
1 parent 32fd607 commit 49042b7

File tree

65 files changed

+21115
-2055
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+21115
-2055
lines changed

.husky/pre-commit

Lines changed: 0 additions & 21 deletions
This file was deleted.

app/Main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ const Main = () => {
4343
const fetchNodeVersion = async (isRetry: boolean = false) => {
4444
try {
4545
const results = await Promise.allSettled([
46-
axios.get('/api/beacon-version', { timeout: 10000 }),
47-
axios.get('/api/lighthouse-version', { timeout: 10000 }),
46+
axios.get('/api/beacon-version', { timeout: 5000 }),
47+
axios.get('/api/lighthouse-version', { timeout: 5000 }),
4848
])
4949

5050
const beaconResult = results[0]

app/api/activity/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function GET(req: Request) {
1313
const token = getReqAuthToken(req)
1414
const data = await fetchActivities({ token, offset, limit, order, since })
1515
return NextResponse.json(data)
16-
} catch (error) {
16+
} catch (_) {
1717
return NextResponse.json({ error: 'Failed to fetch activities' }, { status: 500 })
1818
}
1919
}

app/api/beacon-heartbeat/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function GET(req: Request) {
1414
}
1515

1616
return NextResponse.json({ error: errorMessage }, { status: 500 })
17-
} catch (error) {
17+
} catch (_) {
1818
return NextResponse.json({ error: errorMessage }, { status: 500 })
1919
}
2020
}

app/api/beacon-version/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function GET(req: Request) {
77
const token = getReqAuthToken(req)
88
const { version } = await fetchBeaconNodeVersion(token)
99
return NextResponse.json({ version })
10-
} catch (error) {
10+
} catch (_) {
1111
return NextResponse.json({ error: 'Failed to fetch beacon version' }, { status: 500 })
1212
}
1313
}

app/api/beacon.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BACKEND_URL } from '../../src/constants/envars'
22
import fetchFromApi from '../../utilities/fetchFromApi'
3+
import fetchFromApiWithRetry from '../../utilities/fetchFromApiWithRetry'
34

45
export const fetchNodeHealth = async (token: string) =>
56
await fetchFromApi(`${BACKEND_URL}/node/health`, token)
@@ -10,7 +11,11 @@ export const fetchInclusionRate = async (token: string) =>
1011
export const fetchPeerData = async (token: string) =>
1112
await fetchFromApi(`${BACKEND_URL}/beacon/peer`, token)
1213
export const fetchBeaconSpec = async (token: string) =>
13-
await fetchFromApi(`${BACKEND_URL}/beacon/spec`, token)
14+
await fetchFromApiWithRetry(`${BACKEND_URL}/beacon/spec`, token, undefined, {
15+
maxRetries: 3,
16+
initialDelay: 1000,
17+
timeout: 10000,
18+
})
1419
export const fetchValidatorCountData = async (token: string) =>
1520
await fetchFromApi(`${BACKEND_URL}/beacon/validator-count`, token)
1621
export const fetchProposerDuties = async (token: string) =>

app/api/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BACKEND_URL } from '../../src/constants/envars'
22
import fetchFromApi from '../../utilities/fetchFromApi'
3+
import fetchFromApiWithRetry from '../../utilities/fetchFromApiWithRetry'
34

45
export const fetchBeaconNodeVersion = async (token: string) =>
56
await fetchFromApi(`${BACKEND_URL}/beacon/version`, token)
@@ -10,6 +11,10 @@ export const fetchValidatorAuthKey = async (token: string) =>
1011
export const fetchValidatorVersion = async (token: string) =>
1112
await fetchFromApi(`${BACKEND_URL}/validator/version`, token)
1213
export const fetchGenesisData = async (token: string) =>
13-
await fetchFromApi(`${BACKEND_URL}/beacon/genesis`, token)
14+
await fetchFromApiWithRetry(`${BACKEND_URL}/beacon/genesis`, token, undefined, {
15+
maxRetries: 3,
16+
initialDelay: 1000,
17+
timeout: 10000,
18+
})
1419
export const fetchValidatorStatusExclusionList = async (token: string) =>
1520
await fetchFromApi(`${BACKEND_URL}/exclude-status`, token)

app/api/lighthouse-version/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function GET(req: Request) {
77
const token = getReqAuthToken(req)
88
const { version } = await fetchValidatorVersion(token)
99
return NextResponse.json({ version })
10-
} catch (error) {
10+
} catch (_) {
1111
return NextResponse.json({ error: 'Failed to fetch lighthouse version' }, { status: 500 })
1212
}
1313
}

app/api/log-history/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function GET(req: Request) {
1414
const token = getReqAuthToken(req)
1515
const data = await fetchLogData({ token, limit, offset, type: type as LogType, level })
1616
return NextResponse.json(data)
17-
} catch (error) {
17+
} catch (_) {
1818
return NextResponse.json({ error: 'Failed to fetch log data' }, { status: 500 })
1919
}
2020
}

app/api/log-metrics/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function GET(req: Request) {
1111
const token = getReqAuthToken(req)
1212
const data = await fetchMetrics(token, type as LogType)
1313
return NextResponse.json(data)
14-
} catch (error) {
14+
} catch (_) {
1515
return NextResponse.json({ error: 'Failed to fetch logs metrics' }, { status: 500 })
1616
}
1717
}

0 commit comments

Comments
 (0)