1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 17:28:10 +00:00

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

This commit is contained in:
Vasek Mlejnsky 2018-08-17 08:05:20 +02:00
parent 7d28c6294f
commit b8b0eff161

View File

@ -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>