A local-first personal finance app
Fix net worth graph gradient conflict (#5129)
Olivier Kamersa2abb2b2aef7
diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsxindex 2d75d426b6..7c9a7cf424 100644--- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx+++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx@@ -1,5 +1,5 @@// @ts-strict-ignore-import React from 'react';+import React, { useId } from 'react';import { useTranslation } from 'react-i18next';import { AlignedText } from '@actual-app/components/aligned-text';@@ -50,6 +50,7 @@ export function NetWorthGraph({}: NetWorthGraphProps) {const { t } = useTranslation();const privacyMode = usePrivacyMode();+ const id = useId();const tickFormatter = tick => {const res = privacyMode@@ -74,6 +75,7 @@ export function NetWorthGraph({};const off = gradientOffset();+ const gradientId = `splitColor-${id}`;type PayloadItem = {payload: {@@ -180,7 +182,7 @@ export function NetWorthGraph({/>)}<defs>- <linearGradient id="splitColor" x1="0" y1="0" x2="0" y2="1">+ <linearGradient id={gradientId} x1="0" y1="0" x2="0" y2="1"><stopoffset={off}stopColor={theme.reportsBlue}@@ -201,7 +203,7 @@ export function NetWorthGraph({animationDuration={0}dataKey="y"stroke={theme.reportsBlue}- fill="url(#splitColor)"+ fill={`url(#${gradientId})`}fillOpacity={1}/></AreaChart>diff --git a/upcoming-release-notes/5129.md b/upcoming-release-notes/5129.mdnew file mode 100644index 0000000000..7413bd3586--- /dev/null+++ b/upcoming-release-notes/5129.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [OlivierKamers]+---++Fix net worth graph colors when using multiple graphs that are positive/negative