From 43ebd6d0c5ea88fcb87e713ecdda0f2661dedc08 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Thu, 16 May 2024 08:07:33 -0700
Subject: [PATCH] Fix: handle ghostfolio v2.79.0 breaking API changes (#3471)
---
src/widgets/ghostfolio/component.jsx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/widgets/ghostfolio/component.jsx b/src/widgets/ghostfolio/component.jsx
index 3bd79325..747fdabf 100644
--- a/src/widgets/ghostfolio/component.jsx
+++ b/src/widgets/ghostfolio/component.jsx
@@ -5,8 +5,12 @@ import Block from "components/services/widget/block";
import useWidgetAPI from "utils/proxy/use-widget-api";
function getPerformancePercent(t, performanceRange) {
- return `${performanceRange.performance.currentGrossPerformancePercent > 0 ? "+" : ""}${t("common.percent", {
- value: performanceRange.performance.currentGrossPerformancePercent * 100,
+ // ghostfolio v2.79.0 changed to grossPerformancePercentage
+ const percent =
+ performanceRange.performance.grossPerformancePercentage ??
+ performanceRange.performance.currentGrossPerformancePercent;
+ return `${percent > 0 ? "+" : ""}${t("common.percent", {
+ value: percent * 100,
maximumFractionDigits: 2,
})}`;
}
@@ -24,6 +28,10 @@ export default function Component({ service }) {
return ;
}
+ if (performanceToday?.statusCode === 401) {
+ return ;
+ }
+
if (!performanceToday || !performanceYear || !performanceMax) {
return (