diff --git a/package.json b/package.json index ea0871821..5a74b4db1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "victron-venus-metrics", - "version": "2.0.6", + "version": "2.0.7", "description": "Metric framework for Victron VenusOS", "license": "ISC", "author": "", diff --git a/src/app/App.tsx b/src/app/App.tsx index 138203ff1..35efe9d2a 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4,6 +4,7 @@ import React, { useEffect } from "react" import "../css/index.scss" import { getLocale } from "react-i18nify" import Loading from "./MarineApp/components/Loading" +import { useVisibleWidgetsStore } from "./MarineApp/modules" const KVNRV = React.lazy(() => import("./KVNRV")) const MarineApp = React.lazy(() => import("./MarineApp")) @@ -19,6 +20,7 @@ const App = observer((props: AppProps) => { const appStore = useAppStore() const mqtt = useMqtt() const locale = getLocale() + const visibleWidgetsStore = useVisibleWidgetsStore() useVebus() useEffect(() => { @@ -48,6 +50,11 @@ const App = observer((props: AppProps) => { locale, ]) + useEffect(() => { + visibleWidgetsStore.clearVisibleElements() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [locale]) + if (whitelabel === "KVNRV") { return ( }> diff --git a/src/app/MarineApp/modules/MetricsWidgets/VisibleWidgets.store.ts b/src/app/MarineApp/modules/MetricsWidgets/VisibleWidgets.store.ts index 9f6aca618..6eebe4a2c 100644 --- a/src/app/MarineApp/modules/MetricsWidgets/VisibleWidgets.store.ts +++ b/src/app/MarineApp/modules/MetricsWidgets/VisibleWidgets.store.ts @@ -25,6 +25,10 @@ export class VisibleWidgets { get noVisibleElements() { return !this.visibleElements.size } + + clearVisibleElements() { + this.visibleElements.clear() + } } let store: VisibleWidgets