@gravity-ui/charts 1.38.3 → 1.38.4

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.
@@ -81,8 +81,11 @@ export function useAxis(props) {
81
81
  ]);
82
82
  const isAxesReady = axesStateReady.current;
83
83
  const result = React.useMemo(() => {
84
- return isAxesReady ? Object.assign(Object.assign({}, axesState), { setAxes }) : { xAxis: null, yAxis: [], setAxes };
84
+ if (isAxesReady) {
85
+ return Object.assign(Object.assign({}, axesState), { setAxes });
86
+ }
87
+ prevAxesStateValue.current = { xAxis: null, yAxis: [] };
88
+ return Object.assign(Object.assign({}, prevAxesStateValue.current), { setAxes });
85
89
  }, [isAxesReady, axesState]);
86
- prevAxesStateValue.current = result;
87
90
  return result;
88
91
  }
@@ -49,7 +49,7 @@ const getLeftOffset = ({ preparedLegend, legendConfig, }) => {
49
49
  export const useChartDimensions = (args) => {
50
50
  const { height, margin, preparedLegend, preparedSeries, preparedXAxis, preparedYAxis, width, legendConfig, } = args;
51
51
  return React.useMemo(() => {
52
- if (!preparedLegend || (!legendConfig && (preparedLegend === null || preparedLegend === void 0 ? void 0 : preparedLegend.enabled))) {
52
+ if (!preparedLegend || !legendConfig) {
53
53
  return { boundsWidth: 0, boundsHeight: 0 };
54
54
  }
55
55
  const hasAxisRelatedSeries = preparedSeries.some(isAxisRelatedSeries);
@@ -81,8 +81,11 @@ export function useAxis(props) {
81
81
  ]);
82
82
  const isAxesReady = axesStateReady.current;
83
83
  const result = React.useMemo(() => {
84
- return isAxesReady ? Object.assign(Object.assign({}, axesState), { setAxes }) : { xAxis: null, yAxis: [], setAxes };
84
+ if (isAxesReady) {
85
+ return Object.assign(Object.assign({}, axesState), { setAxes });
86
+ }
87
+ prevAxesStateValue.current = { xAxis: null, yAxis: [] };
88
+ return Object.assign(Object.assign({}, prevAxesStateValue.current), { setAxes });
85
89
  }, [isAxesReady, axesState]);
86
- prevAxesStateValue.current = result;
87
90
  return result;
88
91
  }
@@ -49,7 +49,7 @@ const getLeftOffset = ({ preparedLegend, legendConfig, }) => {
49
49
  export const useChartDimensions = (args) => {
50
50
  const { height, margin, preparedLegend, preparedSeries, preparedXAxis, preparedYAxis, width, legendConfig, } = args;
51
51
  return React.useMemo(() => {
52
- if (!preparedLegend || (!legendConfig && (preparedLegend === null || preparedLegend === void 0 ? void 0 : preparedLegend.enabled))) {
52
+ if (!preparedLegend || !legendConfig) {
53
53
  return { boundsWidth: 0, boundsHeight: 0 };
54
54
  }
55
55
  const hasAxisRelatedSeries = preparedSeries.some(isAxisRelatedSeries);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.38.3",
3
+ "version": "1.38.4",
4
4
  "description": "A flexible JavaScript library for data visualization and chart rendering using React",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",