Fix bug when LeftNavigation menu wasn't properly rendering menus based on props

pull/3/head
Vasek Mlejnsky 6 years ago
parent 7d28c6294f
commit b8b0eff161

@ -70,16 +70,16 @@ class LeftNavigation extends Component {
}); });
} }
componentWillReceiveProps() { componentWillReceiveProps(nextProps) {
const { deviceDropdownOpened } = this.props; const { deviceDropdownOpened } = nextProps;
const { selectedDevice } = this.props.wallet; const { selectedDevice } = nextProps.wallet;
const { network } = this.props.location.state; const hasNetwork = nextProps.location.state && nextProps.location.state.network;
const hasFeatures = selectedDevice && selectedDevice.features; const hasFeatures = selectedDevice && selectedDevice.features;
const deviceReady = hasFeatures && !selectedDevice.features.bootloader_mode && selectedDevice.features.initialized; const deviceReady = hasFeatures && !selectedDevice.features.bootloader_mode && selectedDevice.features.initialized;
if (deviceDropdownOpened) { if (deviceDropdownOpened) {
this.setState({ shouldRenderDeviceSelection: true }); this.setState({ shouldRenderDeviceSelection: true });
} else if (network) { } else if (hasNetwork) {
this.setState({ this.setState({
shouldRenderDeviceSelection: false, shouldRenderDeviceSelection: false,
animationType: 'slide-left', animationType: 'slide-left',
@ -135,9 +135,9 @@ class LeftNavigation extends Component {
> >
<DeviceSelect {...this.props} /> <DeviceSelect {...this.props} />
<MenuWrapper> <MenuWrapper>
{this.state.shouldRenderDeviceSelection && this.getMenuTransition(<DeviceDropdown {...this.props} />) } {this.state.shouldRenderDeviceSelection && <DeviceDropdown {...this.props} />}
{this.shouldRenderAccounts() && this.getMenuTransition(<AccountMenu {...this.props} />)} {this.shouldRenderAccounts() && this.getMenuTransition(<AccountMenu {...this.props} />)}
{this.shouldRenderCoins() && <CoinMenu {...this.props} />} {this.shouldRenderCoins() && this.getMenuTransition(<CoinMenu {...this.props} />)}
</MenuWrapper> </MenuWrapper>
<StickyBottom> <StickyBottom>
<Help> <Help>

Loading…
Cancel
Save