mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 11:01:41 +01:00
b98b0b6d01
The app header would sometimes mistakenly not get rendered while on the Home screen. This could happen when a permission request was made while the UI was open, to either the browser action popup or the fullscreen UI. This was caused by faulty logic in the top-level router component. It would hide the app header if there was a pending permission request, presumably because the author assumed that a redirect to the permission flow would shortly follow. This redirect only happens on mount though, not if the UI was already open when the permission request was submitted. The intent of this logic was to hide a brief flash of the app header prior to rendering the permission flow. This brief flash has now been restored, which is unfortunate, but is better than the missing app header bug. We can revisit a solution to removing this flash in the future, hopefully in a manner that avoids this bug and works for all notification UI cases.
63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
import { connect } from 'react-redux'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { compose } from 'redux'
|
|
import {
|
|
getNetworkIdentifier,
|
|
getPreferences,
|
|
submittedPendingTransactionsSelector,
|
|
} from '../../selectors'
|
|
import {
|
|
hideSidebar,
|
|
lockMetamask,
|
|
setCurrentCurrency,
|
|
setLastActiveTime,
|
|
setMouseUserState,
|
|
} from '../../store/actions'
|
|
import { pageChanged } from '../../ducks/history/history'
|
|
import { prepareToLeaveSwaps } from '../../ducks/swaps/swaps'
|
|
import Routes from './routes.component'
|
|
|
|
function mapStateToProps (state) {
|
|
const { appState } = state
|
|
const {
|
|
sidebar,
|
|
alertOpen,
|
|
alertMessage,
|
|
isLoading,
|
|
loadingMessage,
|
|
} = appState
|
|
const { autoLockTimeLimit = 0 } = getPreferences(state)
|
|
|
|
return {
|
|
sidebar,
|
|
alertOpen,
|
|
alertMessage,
|
|
textDirection: state.metamask.textDirection,
|
|
isLoading,
|
|
loadingMessage,
|
|
isUnlocked: state.metamask.isUnlocked,
|
|
submittedPendingTransactions: submittedPendingTransactionsSelector(state),
|
|
network: state.metamask.network,
|
|
provider: state.metamask.provider,
|
|
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
|
|
currentCurrency: state.metamask.currentCurrency,
|
|
isMouseUser: state.appState.isMouseUser,
|
|
providerId: getNetworkIdentifier(state),
|
|
autoLockTimeLimit,
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
lockMetaMask: () => dispatch(lockMetamask(false)),
|
|
hideSidebar: () => dispatch(hideSidebar()),
|
|
setCurrentCurrencyToUSD: () => dispatch(setCurrentCurrency('usd')),
|
|
setMouseUserState: (isMouseUser) => dispatch(setMouseUserState(isMouseUser)),
|
|
setLastActiveTime: () => dispatch(setLastActiveTime()),
|
|
pageChanged: (path) => dispatch(pageChanged(path)),
|
|
prepareToLeaveSwaps: () => dispatch(prepareToLeaveSwaps()),
|
|
}
|
|
}
|
|
|
|
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps))(Routes)
|