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

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,29 @@ 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);
25416
+ const prevProps = useRef({
25417
+ range: null,
25418
+ axes: null
25419
+ });
25420
+ console.log("prevRange.current", prevProps.current);
25418
25421
  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]);
25422
+ const axes = range && isRangeValid(range) && Object.entries(range).map(([key, { min, max }]) => ({
25423
+ id: key,
25424
+ min: min ?? 0,
25425
+ max: max ?? 0
25426
+ }));
25427
+ console.log("RANGE", !isEqual(range, prevProps.current.range));
25428
+ console.log("AXES", !isEqual(axes, prevProps.current.axes));
25429
+ if (!isEqual(axes, prevProps.current.axes)) {
25430
+ console.log("UPDATE_AXES_RANGES");
25431
+ dispatch({
25432
+ type: UPDATE_AXES_RANGES,
25433
+ payload: { axes }
25434
+ });
25435
+ prevProps.current.range = range;
25436
+ prevProps.current.axes = axes;
25437
+ console.log("-----------------------");
25438
+ }
25437
25439
  };
25438
25440
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25439
25441
  const prevGeneratedDatasets = useRef();
@@ -25462,7 +25464,7 @@ const useChartState = ({
25462
25464
  const memoState = useMemo(() => state, [state]);
25463
25465
  const memoOptions = useMemo(() => options, [options]);
25464
25466
  const {
25465
- additionalAxesOptions: { range },
25467
+ additionalAxesOptions: { range = null },
25466
25468
  axes
25467
25469
  } = memoOptions;
25468
25470
  useStoreChartStateInStorage(memoState, persistenceId);