diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index d17f1de8b4..16a931e98a 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -2,7 +2,7 @@ import "./preferences.scss"; import React from "react"; import { computed, observable, reaction } from "mobx"; -import { observer } from "mobx-react"; +import { disposeOnUnmount, observer } from "mobx-react"; import { userStore } from "../../../common/user-store"; import { isWindows } from "../../../common/vars"; @@ -31,12 +31,14 @@ export class Preferences extends React.Component { } componentDidMount() { - reaction(() => navigation.location.hash, hash => { - document.getElementById(hash.slice(1))?.scrollIntoView(); - navigation.location.hash = ""; - }, { - fireImmediately: true - }); + disposeOnUnmount(this, [ + reaction(() => navigation.location.hash, hash => { + document.getElementById(hash.slice(1))?.scrollIntoView(); + navigation.location.hash = ""; + }, { + fireImmediately: true + }) + ]); } render() {