@oliasoft-open-source/charts-library 3.5.1-beta-7 → 3.5.1-beta-9

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
@@ -25413,27 +25413,19 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
25413
25413
  ]);
25414
25414
  };
25415
25415
  const useUpdateAxesRanges = (range, dispatch) => {
25416
- const prevRange = useRef(null);
25417
- console.log("prevRange.current", prevRange.current);
25418
- console.log("Range", range);
25419
- const updateAxesRanges = () => {
25420
- if (range && isRangeValid(range)) {
25421
- console.log("UPDATE_AXES_RANGES", range);
25422
- const axes = Object.entries(range).map(([key, { min, max }]) => ({
25423
- id: key,
25424
- min: min ?? 0,
25425
- max: max ?? 0
25426
- }));
25427
- dispatch({
25428
- type: UPDATE_AXES_RANGES,
25429
- payload: { axes }
25430
- });
25431
- prevRange.current = range;
25432
- }
25433
- };
25434
- useEffect(() => {
25435
- updateAxesRanges();
25436
- }, [range]);
25416
+ const prevAxes = useRef(null);
25417
+ const axes = range && isRangeValid(range) ? Object.entries(range).map(([key, { min, max }]) => ({
25418
+ id: key,
25419
+ min: min ?? 0,
25420
+ max: max ?? 0
25421
+ })) : null;
25422
+ if (!isEqual(axes, prevAxes.current)) {
25423
+ dispatch({
25424
+ type: UPDATE_AXES_RANGES,
25425
+ payload: { axes }
25426
+ });
25427
+ prevAxes.current = axes;
25428
+ }
25437
25429
  };
25438
25430
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25439
25431
  const prevGeneratedDatasets = useRef();
@@ -25462,7 +25454,7 @@ const useChartState = ({
25462
25454
  const memoState = useMemo(() => state, [state]);
25463
25455
  const memoOptions = useMemo(() => options, [options]);
25464
25456
  const {
25465
- additionalAxesOptions: { range },
25457
+ additionalAxesOptions: { range = null },
25466
25458
  axes
25467
25459
  } = memoOptions;
25468
25460
  useStoreChartStateInStorage(memoState, persistenceId);