Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
fix appDataHash initial state being undefined when state was rehydrat…
Browse files Browse the repository at this point in the history
…ed from local storage (#1743)
  • Loading branch information
ramirotw authored Nov 2, 2021
1 parent a34a0d8 commit bd9fe2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/custom/state/affiliate/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useCallback } from 'react'
import { useSelector } from 'react-redux'
import { AppState } from 'state'
import { useAppDispatch } from 'state/hooks'
import { updateAppDataHash, updateReferralAddress } from 'state/affiliate/actions'
import { useCallback } from 'react'
import { generateReferralMetadataDoc, uploadMetadataDocToIpfs } from 'utils/metadata'
import { APP_DATA_HASH } from 'constants/index'

export function useAppDataHash() {
return useSelector<AppState, string>((state) => {
return state.affiliate.appDataHash
return state.affiliate.appDataHash || APP_DATA_HASH
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/custom/state/affiliate/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface AffiliateState {
value: string
isValid: boolean
}
appDataHash: string
appDataHash?: string
}

export const initialState: AffiliateState = {
Expand Down

0 comments on commit bd9fe2e

Please sign in to comment.