Skip to content

Commit 4d112cc

Browse files
committed
Preserve historical ETH networth data in charts
Remove server-side usdValue filter to preserve historical ETH-only records. Filter on client instead: ETH mode shows all records, USD mode filters for records with usdValue.
1 parent daebac5 commit 4d112cc

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

client/src/hooks/useHono.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,14 @@ export function useNetworthTimeSeries(currency: string | undefined) {
115115
const res = await honoClient.balances.networth.$get()
116116
const json = await res.json()
117117

118-
return json.map((item) => ({
119-
...item,
120-
value: currency === 'ETH' ? item.ethValue : (item.usdValue as number),
121-
}))
118+
// For ETH: all records are valid (they all have ethValue)
119+
// For USD: only records with usdValue are valid
120+
return json
121+
.filter((item) => currency === 'ETH' || item.usdValue != null)
122+
.map((item) => ({
123+
...item,
124+
value: currency === 'ETH' ? item.ethValue : (item.usdValue as number),
125+
}))
122126
},
123127
})
124128
}

server/src/handlers/balances.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ export async function getNetworthTimeSeries(c: Context) {
182182
const networth = await db
183183
.selectFrom('networth')
184184
.selectAll()
185-
.where('usdValue', 'is not', null)
186185
.limit(60)
187186
.orderBy('timestamp', 'desc')
188187
.execute()

0 commit comments

Comments
 (0)