diff --git a/js/src/modals/UpgradeParity/store.js b/js/src/modals/UpgradeParity/store.js
index 587872407..5cf3ddc85 100644
--- a/js/src/modals/UpgradeParity/store.js
+++ b/js/src/modals/UpgradeParity/store.js
@@ -27,7 +27,7 @@ const STEP_UPDATING = 1;
const STEP_COMPLETED = 2;
const STEP_ERROR = 2;
-const CHECK_INTERVAL = 1 * A_MINUTE;
+let instance = null;
export default class Store {
@observable available = null;
@@ -44,8 +44,6 @@ export default class Store {
this.loadStorage();
this.checkUpgrade();
-
- setInterval(this.checkUpgrade, CHECK_INTERVAL);
}
@computed get isVisible () {
@@ -119,10 +117,10 @@ export default class Store {
checkUpgrade = () => {
if (!this._api) {
- return;
+ return Promise.resolve(false);
}
- Promise
+ return Promise
.all([
this._api.parity.upgradeReady(),
this._api.parity.consensusCapability(),
@@ -134,11 +132,23 @@ export default class Store {
}
this.setVersions(available, version, consensusCapability);
+
+ return true;
})
.catch((error) => {
console.warn('checkUpgrade', error);
+
+ return false;
});
}
+
+ static get (api) {
+ if (!instance) {
+ instance = new Store(api);
+ }
+
+ return instance;
+ }
}
export {
diff --git a/js/src/redux/providers/status.js b/js/src/redux/providers/status.js
index e419d78f8..8456f2d9a 100644
--- a/js/src/redux/providers/status.js
+++ b/js/src/redux/providers/status.js
@@ -14,29 +14,30 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-import BalancesProvider from './balances';
-import { statusBlockNumber, statusCollection, statusLogs } from './statusActions';
import { isEqual } from 'lodash';
import { LOG_KEYS, getLogger } from '~/config';
+import UpgradeStore from '~/modals/UpgradeParity/store';
+
+import BalancesProvider from './balances';
+import { statusBlockNumber, statusCollection, statusLogs } from './statusActions';
const log = getLogger(LOG_KEYS.Signer);
let instance = null;
export default class Status {
+ _apiStatus = {};
+ _status = {};
+ _longStatus = {};
+ _minerSettings = {};
+ _timeoutIds = {};
+ _blockNumberSubscriptionId = null;
+ _timestamp = Date.now();
+
constructor (store, api) {
this._api = api;
this._store = store;
-
- this._apiStatus = {};
- this._status = {};
- this._longStatus = {};
- this._minerSettings = {};
-
- this._timeoutIds = {};
- this._blockNumberSubscriptionId = null;
-
- this._timestamp = Date.now();
+ this._upgradeStore = UpgradeStore.get(api);
// On connecting, stop all subscriptions
api.on('connecting', this.stop, this);
@@ -281,10 +282,11 @@ export default class Status {
this._api.parity.netChain(),
this._api.parity.netPort(),
this._api.parity.rpcSettings(),
- this._api.parity.enode()
+ this._api.parity.enode(),
+ this._upgradeStore.checkUpgrade()
])
.then(([
- netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode
+ netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode, upgradeStatus
]) => {
const isTest =
netVersion === '2' || // morden
diff --git a/js/src/views/Application/application.js b/js/src/views/Application/application.js
index 256ff0212..2b32cf64e 100644
--- a/js/src/views/Application/application.js
+++ b/js/src/views/Application/application.js
@@ -51,7 +51,7 @@ class Application extends Component {
}
store = new Store(this.context.api);
- upgradeStore = new UpgradeStore(this.context.api);
+ upgradeStore = UpgradeStore.get(this.context.api);
render () {
const [root] = (window.location.hash || '').replace('#/', '').split('/');
@@ -65,7 +65,11 @@ class Application extends Component {
return (
- { isMinimized ? this.renderMinimized() : this.renderApp() }
+ {
+ isMinimized
+ ? this.renderMinimized()
+ : this.renderApp()
+ }