Skip to content

Commit

Permalink
Fix no connection banner (#452)
Browse files Browse the repository at this point in the history
* Fix red no connection banner

* Fixed app forget smeshing is enabled
  • Loading branch information
Ilya Vilensky authored Mar 24, 2020
1 parent 09e0832 commit f2fa0d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions app/components/banners/InfoBanner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import React, { Component } from 'react';
import styled from 'styled-components';
import { connect } from 'react-redux';
import { Banner } from '/basicComponents';
Expand Down Expand Up @@ -28,7 +28,7 @@ type Props = {
status: Object
};

class InfoBanner extends PureComponent<Props> {
class InfoBanner extends Component<Props> {
startUpDelay = 5; // eslint-disable-line react/sort-comp

noPeersCounter = 0; // eslint-disable-line react/sort-comp
Expand All @@ -41,8 +41,6 @@ class InfoBanner extends PureComponent<Props> {
if (this.startUpDelay === 5) {
color = smColors.red;
text = 'Offline. Please quit and start the app again.';
} else {
this.startUpDelay += 1;
}
} else if (!status.peers) {
if (this.noPeersCounter === 30) {
Expand All @@ -69,6 +67,14 @@ class InfoBanner extends PureComponent<Props> {
</Banner>
) : null;
}

shouldComponentUpdate(nextProps: Props) {
const { status } = this.props;
if (status === null && nextProps.status === null) {
this.startUpDelay += 1;
}
return nextProps.status !== status || this.startUpDelay === 5;
}
}

const mapStateToProps = (state) => ({
Expand Down
2 changes: 1 addition & 1 deletion desktop/nodeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class NodeManager {

if (prevGenesisTime !== fetchedGenesisTime) {
StoreService.set({ key: 'genesisTime', value: fetchedGenesisTime });
StoreService.remove({ key: 'savedMiningParams' });
StoreService.remove({ key: 'miningParams' });
await FileSystemManager.cleanWalletFile();
const command =
os.type() === 'Windows_NT'
Expand Down

0 comments on commit f2fa0d1

Please sign in to comment.