refactor: Always render BloombergView and handle missing company ID and data loading state internally.
This commit is contained in:
parent
c729872b07
commit
2bc05c3810
@ -381,17 +381,15 @@ function CompanyAnalysisView({
|
||||
)}
|
||||
|
||||
{dataSource === 'Bloomberg' ? (
|
||||
status?.company_id && (
|
||||
<BloombergView
|
||||
selectedCurrency={currency}
|
||||
userMarket={company.market}
|
||||
companyId={status.company_id}
|
||||
companyId={status?.company_id || 0} // Pass 0 or null if not valid yet, View handles it
|
||||
companySymbol={company.symbol}
|
||||
companyMarket={company.market}
|
||||
companyName={company.company_name}
|
||||
lastUpdate={status.last_update?.date}
|
||||
lastUpdate={status?.last_update?.date}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
status?.company_id && (
|
||||
<FinancialTables
|
||||
|
||||
@ -40,7 +40,11 @@ export function BloombergView({ companyId, companySymbol, companyMarket, company
|
||||
const { fetching, fetchData, updateStatus } = useFinancialData(companyObj, "Bloomberg")
|
||||
|
||||
const loadData = async () => {
|
||||
if (!companyId) return
|
||||
if (!companyId) {
|
||||
setLoading(false) // Stop loading if no ID
|
||||
setData(null)
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true)
|
||||
setError("")
|
||||
@ -97,8 +101,6 @@ export function BloombergView({ companyId, companySymbol, companyMarket, company
|
||||
)
|
||||
}
|
||||
|
||||
if (!data && !fetching) return null
|
||||
|
||||
// 如果后端提供了统一数据字段,直接使用
|
||||
const mergedData = data?.unified_data || []
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user