Skip to content

Commit

Permalink
Fix delegation fee calculation crashing while clicking between tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
refi93 committed Aug 3, 2022
1 parent c1a0d46 commit d906b69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/frontend/actions/delegate.ts
Expand Up @@ -67,7 +67,11 @@ export default (store: Store) => {
const calculateDelegationFee = async (): Promise<void> => {
const state = getState()
await setPoolInfo(state)
assert(state.shelleyDelegation?.selectedPool != null)
// selectedPool may be null e.g. when switching tab and selectedPool
// is already reset when this debounced function is executed
if (state.shelleyDelegation?.selectedPool == null) {
return
}
const poolHash = state.shelleyDelegation.selectedPool.poolHash as string
const isStakingKeyRegistered = getSourceAccountInfo(state).shelleyAccountInfo.hasStakingKey
const stakingAddress = getSourceAccountInfo(state).stakingAddress
Expand Down

0 comments on commit d906b69

Please sign in to comment.