diff --git a/packages/plugins/charts/src/client/hooks/index.ts b/packages/plugins/charts/src/client/hooks/index.ts index a3ddd19990..07d1d6fe66 100644 --- a/packages/plugins/charts/src/client/hooks/index.ts +++ b/packages/plugins/charts/src/client/hooks/index.ts @@ -8,7 +8,7 @@ const useFieldsById = (queryId: number) => { const chartQueryList = ctx?.data; if (chartQueryList && Array.isArray(chartQueryList)) { const currentQuery = chartQueryList.find((chartQuery) => chartQuery.id === queryId); - setFields(currentQuery?.fields); + setFields(currentQuery?.fields || []); } }, [queryId]); return {