From 3d225106b7c6072df566744d0e4d7a13343309b3 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 6 Jun 2019 18:46:17 -0500 Subject: [PATCH] Handle unmount --- src/App.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 7bfbade..1b15064 100644 --- a/src/App.js +++ b/src/App.js @@ -32,8 +32,6 @@ class App extends IPCContainer { this.setRequestHandler(Constants.IPC_Get_State_Reply, this.onGetStateReply); this.setRequestHandler(Constants.IPC_Install_Dependency_Reply, this.onInstallDependencyReply); this.setRequestHandler(Constants.IPC_Install_Upgrade_Reply, this.onInstallUpgradeReply); - - Scheduler.scheduleJob('23 11 * * *', this.updateCheckScheduledJob); } state = { @@ -89,6 +87,7 @@ class App extends IPCContainer { componentDidMount() { this.sendRequest(Constants.IPC_Get_State); + this.scheduledUpdateJob = Scheduler.scheduleJob('23 11 * * *', this.updateCheckScheduledJob); } componentDidUpdate(prevProps) { @@ -104,6 +103,11 @@ class App extends IPCContainer { } } + componentWillUnmount() { + Scheduler.cancelJob(this.scheduledUpdateJob); + super.componentWillUnmount(); + } + extractFileNameFromURL = url => { const parts = url.split('/'); return parts[parts.length - 1];