feat: improve stock detail charts and quote fallbacks

This commit is contained in:
wanghep
2026-04-18 22:16:03 +08:00
parent dc205c5f1b
commit 36fda633df
9 changed files with 851 additions and 83 deletions

View File

@ -229,9 +229,17 @@ export function useDashboardData() {
selectedTraderId.value = traderResult[0].id
}
const preferredStockCode = watchlist.value[0]?.stock_code ?? warningResult[0]?.stock_code
const watchlistCodeSet = new Set(watchlistResult.map((item) => item.stock_code))
const preferredWarningCode =
warningResult.find((item) => watchlistCodeSet.has(item.stock_code))?.stock_code ??
warningResult[0]?.stock_code ??
''
const preferredStockCode = watchlist.value[0]?.stock_code ?? preferredWarningCode
if (preferredWarningCode) {
selectedWarningCode.value = preferredWarningCode
}
if (preferredStockCode) {
selectedWarningCode.value = preferredStockCode
selectedStockCode.value = preferredStockCode
}
} catch (error) {