diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-08 23:42:49 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-08 23:42:49 +0100 |
commit | d15efc6ba99ab26735dcf7a83303ab0b148ecd46 (patch) | |
tree | 8d9418351b9cc5cd394b9fa41ee248dae0361c1d /src/components | |
parent | Fix linting issues (diff) | |
download | ferdium-app-d15efc6ba99ab26735dcf7a83303ab0b148ecd46.tar.gz ferdium-app-d15efc6ba99ab26735dcf7a83303ab0b148ecd46.tar.zst ferdium-app-d15efc6ba99ab26735dcf7a83303ab0b148ecd46.zip |
Dispose autorun on component unmount
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 3ec0c3a67..f59205c0e 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -33,7 +33,7 @@ export default @observer class ServiceWebview extends Component { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | componentDidMount() { | 35 | componentDidMount() { |
36 | autorun(() => { | 36 | this.autorunDisposer = autorun(() => { |
37 | if (this.props.service.isActive) { | 37 | if (this.props.service.isActive) { |
38 | this.setState({ forceRepaint: true }); | 38 | this.setState({ forceRepaint: true }); |
39 | setTimeout(() => { | 39 | setTimeout(() => { |
@@ -43,6 +43,10 @@ export default @observer class ServiceWebview extends Component { | |||
43 | }); | 43 | }); |
44 | } | 44 | } |
45 | 45 | ||
46 | componentWillUnmount() { | ||
47 | this.autorunDisposer(); | ||
48 | } | ||
49 | |||
46 | updateTargetUrl = (event) => { | 50 | updateTargetUrl = (event) => { |
47 | let visible = true; | 51 | let visible = true; |
48 | if (event.url === '' || event.url === '#') { | 52 | if (event.url === '' || event.url === '#') { |
@@ -54,6 +58,7 @@ export default @observer class ServiceWebview extends Component { | |||
54 | }); | 58 | }); |
55 | } | 59 | } |
56 | 60 | ||
61 | autorunDisposer = null; | ||
57 | webview = null; | 62 | webview = null; |
58 | 63 | ||
59 | render() { | 64 | render() { |