@centreon/ui 26.11.4 → 26.11.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "26.11.4",
3
+ "version": "26.11.5",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -378,7 +378,7 @@ const Chart = ({
378
378
  )}
379
379
  {additionalLines?.map((additionalLine) => (
380
380
  <AdditionalLine
381
- key={additionalLine.yValue}
381
+ key={JSON.stringify(additionalLine)}
382
382
  {...additionalLine}
383
383
  graphWidth={graphWidth}
384
384
  yScale={yScalesPerUnit[additionalLine.unit]}
@@ -1,11 +1,11 @@
1
1
  import type { ScaleLinear } from 'd3-scale';
2
- import { useMemo } from 'react';
2
+ import { ReactElement, useMemo } from 'react';
3
3
 
4
4
  import type { AdditionalLineProps } from '../models';
5
5
 
6
6
  interface Props extends AdditionalLineProps {
7
7
  graphWidth: number;
8
- yScale: ScaleLinear<number, number>;
8
+ yScale?: ScaleLinear<number, number>;
9
9
  }
10
10
 
11
11
  const AdditionalLine = ({
@@ -14,8 +14,12 @@ const AdditionalLine = ({
14
14
  text,
15
15
  graphWidth,
16
16
  yScale
17
- }: Props): JSX.Element => {
18
- const positionY = useMemo(() => yScale(yValue), [yValue, yScale]);
17
+ }: Props): ReactElement | null => {
18
+ const positionY = useMemo(() => yScale?.(yValue), [yValue, yScale]);
19
+
20
+ if (positionY === undefined) {
21
+ return null;
22
+ }
19
23
 
20
24
  return (
21
25
  <g>