@evergis/react 4.0.72 → 4.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12185,12 +12185,16 @@ const useChartData = ({ element, type }) => {
12185
12185
  layerInfos,
12186
12186
  dataSources,
12187
12187
  ]);
12188
+ const isResolved = React.useMemo(() => !relatedAttributes?.length ||
12189
+ relatedAttributes
12190
+ .filter(({ chartAxis }) => chartAxis === "y")
12191
+ .every(({ dataSourceName }) => Array.isArray(getDataSource(dataSourceName, dataSources)?.features)), [relatedAttributes, dataSources]);
12188
12192
  const [data, setData] = React.useState(fetchedData);
12189
12193
  React.useEffect(() => {
12190
- if (!loading) {
12194
+ if (!loading && (fetchedData?.length || isResolved)) {
12191
12195
  setData(fetchedData);
12192
12196
  }
12193
- }, [loading, fetchedData]);
12197
+ }, [loading, fetchedData, isResolved]);
12194
12198
  return { data, loading };
12195
12199
  };
12196
12200