1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

disposeOnUmount

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-03-17 08:18:01 -04:00
parent 88b204f60c
commit 63fd8101f2

View File

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