fix: protect ECharts setOption from invalid data + add import debug logs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b218a487a
commit
b7edc7f86e
|
|
@ -53,8 +53,12 @@ export const EChartsBase: React.FC<EChartsBaseProps> = ({
|
||||||
|
|
||||||
// Update option
|
// Update option
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!chartRef.current) return;
|
if (!chartRef.current || !option) return;
|
||||||
chartRef.current.setOption(option, { notMerge: true });
|
try {
|
||||||
|
chartRef.current.setOption(option, { notMerge: true });
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('ECharts setOption error:', e);
|
||||||
|
}
|
||||||
}, [option]);
|
}, [option]);
|
||||||
|
|
||||||
// Handle loading state
|
// Handle loading state
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,9 @@ export function useImportData() {
|
||||||
try {
|
try {
|
||||||
const rowsResp = await dataServiceClient.getRows(dataSetId, 10000);
|
const rowsResp = await dataServiceClient.getRows(dataSetId, 10000);
|
||||||
rows = rowsResp.rows ?? rowsResp ?? [];
|
rows = rowsResp.rows ?? rowsResp ?? [];
|
||||||
} catch {
|
console.log(`[DataViz] Fetched ${rows.length} rows for dataset ${dataSetId}`);
|
||||||
// rows fetch failed, continue without
|
} catch (e) {
|
||||||
|
console.error('[DataViz] Failed to fetch rows:', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataSet = mapBackendDataSet(rawDataSet, rows);
|
const dataSet = mapBackendDataSet(rawDataSet, rows);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue