@oliasoft-open-source/charts-library 3.7.1 → 3.7.2

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
@@ -11,7 +11,7 @@ import { produce } from "immer";
11
11
  import { round as round$2, displayNumber, isCloseTo, roundByMagnitude, toNum } from "@oliasoft-open-source/units";
12
12
  import cx from "classnames";
13
13
  import { Icon, Tooltip as Tooltip$2, Button, Flex, Text, Menu, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Portal } from "@oliasoft-open-source/react-ui-library";
14
- import { isEmpty, isArray as isArray$2, some, has, debounce as debounce$3, isEqual } from "lodash";
14
+ import { isEmpty, isArray as isArray$2, some, has, debounce as debounce$3 } from "lodash";
15
15
  import { roundNumberToPrecision } from "@oliasoft-open-source/units/dist/rounding/rounding";
16
16
  /*!
17
17
  * @kurkle/color v0.3.2
@@ -20349,7 +20349,7 @@ var fastDeepEqual = function equal(a2, b2) {
20349
20349
  }
20350
20350
  return a2 !== a2 && b2 !== b2;
20351
20351
  };
20352
- const equal2 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqual);
20352
+ const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqual);
20353
20353
  const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
20354
20354
  function useCollector(monitor, collect, onUpdate) {
20355
20355
  const [collected, setCollected] = useState(
@@ -20357,7 +20357,7 @@ function useCollector(monitor, collect, onUpdate) {
20357
20357
  );
20358
20358
  const updateCollected = useCallback(() => {
20359
20359
  const nextValue = collect(monitor);
20360
- if (!equal2(collected, nextValue)) {
20360
+ if (!isEqual(collected, nextValue)) {
20361
20361
  setCollected(nextValue);
20362
20362
  if (onUpdate) {
20363
20363
  onUpdate();
@@ -25908,23 +25908,26 @@ const useUpdateAxesRanges = ({
25908
25908
  }
25909
25909
  }, [range]);
25910
25910
  };
25911
- const useSaveInitialAxesRanges = (chartRef, axes, dispatch) => {
25911
+ const useSaveInitialAxesRanges = (chartRef, axes, dispatch, generatedDatasets) => {
25912
+ const prevDatasets = useRef(null);
25912
25913
  useEffect(() => {
25913
- if (chartRef.current) {
25914
+ if (chartRef.current && !isEqual(prevDatasets.current, generatedDatasets)) {
25914
25915
  const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
25915
25916
  dispatch({
25916
25917
  type: SAVE_INITIAL_AXES_RANGES,
25917
25918
  payload: { initialAxesRanges }
25918
25919
  });
25920
+ prevDatasets.current = generatedDatasets;
25919
25921
  }
25920
- }, []);
25922
+ }, [generatedDatasets]);
25921
25923
  };
25922
25924
  const useChartState = ({
25923
25925
  chartRef,
25924
25926
  options,
25925
25927
  state,
25926
25928
  dispatch,
25927
- persistenceId
25929
+ persistenceId,
25930
+ generatedDatasets
25928
25931
  }) => {
25929
25932
  const memoState = useMemo(() => state, [state]);
25930
25933
  const memoOptions = useMemo(() => options, [options]);
@@ -25942,7 +25945,7 @@ const useChartState = ({
25942
25945
  chartRef,
25943
25946
  annotationsData
25944
25947
  });
25945
- useSaveInitialAxesRanges(chartRef, axes, dispatch);
25948
+ useSaveInitialAxesRanges(chartRef, axes, dispatch, generatedDatasets);
25946
25949
  };
25947
25950
  const WORD_SEPARATOR = " ";
25948
25951
  const SEMI_TRANSPARENT = "rgba(0, 0, 0, 0.5)";
@@ -26179,7 +26182,8 @@ const LineChart = (props) => {
26179
26182
  options,
26180
26183
  state,
26181
26184
  dispatch,
26182
- persistenceId
26185
+ persistenceId,
26186
+ generatedDatasets
26183
26187
  });
26184
26188
  const { resetZoom: resetZoom2, handleKeyDown, handleKeyUp } = useChartFunctions({
26185
26189
  chartRef,