File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -326,12 +326,18 @@ const LineComponent = ({
326326 } ) ;
327327 } , [ line . lineColor , line . trailingOpacity ] ) ;
328328
329- const pathStartX = line ?. data [ 0 ] ?. x
330- ? localPath ?. x ( line ?. data [ 0 ] ?. x )
331- : undefined ;
332- const pathEndX = line ?. data [ line ?. data ?. length - 1 ] ?. x
333- ? localPath ?. x ( line ?. data [ line ?. data ?. length - 1 ] ?. x || 0 )
334- : undefined ;
329+ const { pathStartX, pathEndX} = useMemo ( ( ) => {
330+ const pathStartX = line ?. data [ 0 ] ?. x
331+ ? localPath ?. x ( line ?. data [ 0 ] ?. x )
332+ : 0 ;
333+ const pathEndX = line ?. data [ line ?. data ?. length - 1 ] ?. x
334+ ? localPath ?. x ( line ?. data [ line ?. data ?. length - 1 ] ?. x || 0 )
335+ : svgWidth ;
336+ return {
337+ pathStartX,
338+ pathEndX,
339+ } ;
340+ } , [ ] ) ;
335341
336342 return (
337343 < >
@@ -342,10 +348,10 @@ const LineComponent = ({
342348 < LinearGradient
343349 id = { getBackgroundIdentifier ( ) }
344350 gradientUnits = "userSpaceOnUse"
345- x1 = { pathEndX }
346351 y1 = "0"
347- x2 = { pathStartX }
348352 y2 = "0"
353+ x1 = { pathEndX }
354+ x2 = { pathStartX }
349355 >
350356 {
351357 getStopPoints ( ) as ReactElement <
You can’t perform that action at this time.
0 commit comments