@oliasoft-open-source/charts-library 3.5.1-beta-6 → 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,34 +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
- console.log("is NOT Equal", !isEqual(range, prevRange.current));
25420
- console.log("range && range.x && range.y", range && range.x && range.y);
25421
- console.log("isRangeValid", isRangeValid(range));
25422
- const updateAxesRanges = () => {
25423
- console.log(
25424
- "IF STATEMENT",
25425
- range && range.x && range.y && !isEqual(range, prevRange.current)
25426
- );
25427
- if (range && range.x && range.y && !isEqual(range, prevRange.current)) {
25428
- console.log("UPDATE_AXES_RANGES", range);
25429
- const axes = Object.entries(range).map(([key, { min, max }]) => ({
25430
- id: key,
25431
- min: min ?? 0,
25432
- max: max ?? 0
25433
- }));
25434
- dispatch({
25435
- type: UPDATE_AXES_RANGES,
25436
- payload: { axes }
25437
- });
25438
- prevRange.current = range;
25439
- }
25440
- };
25441
- useEffect(() => {
25442
- updateAxesRanges();
25443
- }, [updateAxesRanges]);
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
+ }
25444
25439
  };
25445
25440
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25446
25441
  const prevGeneratedDatasets = useRef();
@@ -25469,11 +25464,9 @@ const useChartState = ({
25469
25464
  const memoState = useMemo(() => state, [state]);
25470
25465
  const memoOptions = useMemo(() => options, [options]);
25471
25466
  const {
25472
- additionalAxesOptions: { range },
25467
+ additionalAxesOptions: { range = null },
25473
25468
  axes
25474
25469
  } = memoOptions;
25475
- console.log("state.initialAxesRanges", state == null ? void 0 : state.initialAxesRanges);
25476
- console.log("memoState.initialAxesRanges", memoState == null ? void 0 : memoState.initialAxesRanges);
25477
25470
  useStoreChartStateInStorage(memoState, persistenceId);
25478
25471
  useToggleCustomLegendVisibility(memoState, memoOptions);
25479
25472
  useUpdateAxesRanges(range, dispatch);