You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The website fails to load data and crashes when a network error occurs, displaying the following console error: Cannot read properties of undefined (reading 'tx_count_rolling') screenshot attached below
This happens because getnetwork() in message-api.ts return an empty array on errors
`export async function getNetworkStats(): Promise<NetworkStat[]> {
try {
const result = await goldsky.query(networkStatsQuery, {}).toPromise()
if (!result.data) return []
The website fails to load data and crashes when a network error occurs, displaying the following console error:
Cannot read properties of undefined (reading 'tx_count_rolling')
screenshot attached belowThis happens because
getnetwork()
inmessage-api.ts
return an empty array on errors`export async function getNetworkStats(): Promise<NetworkStat[]> {
try {
const result = await goldsky.query(networkStatsQuery, {}).toPromise()
if (!result.data) return []
} catch (error) {
console.error(error)
return []
}`
and in homepage
const totalMessages = useMemo( () => (stats ? stats[stats.length - 1].tx_count_rolling : 0), [stats], )
The
stats ?
check only verifies ifstats
is notnull
orundefined
, but it doesn’t ensure the array has elements.Create a pull request for this issue
#36
The text was updated successfully, but these errors were encountered: