fix(charts): fields undefined bug (#1980)

This commit is contained in:
YANG QIA 2023-06-05 13:13:06 +08:00 committed by GitHub
parent ad726e6a94
commit ecb2af8fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {