Skip to content

Commit c68f454

Browse files
authored
fix: Nervos Dao record will lost for a while (nervosnetwork#3309)
fix: Nervos Dao record will lost for a while when close mutisig addresses window
1 parent 95823eb commit c68f454

File tree

1 file changed

+11
-11
lines changed
  • packages/neuron-ui/src/components/MultisigAddress

1 file changed

+11
-11
lines changed

packages/neuron-ui/src/components/MultisigAddress/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import {
77
useGoBack,
88
useOnWindowResize,
99
calculateFee,
10-
useClearGeneratedTx,
1110
} from 'utils'
1211
import appState from 'states/init/app'
13-
import { useState as useGlobalState, useDispatch } from 'states'
12+
import { useState as useGlobalState } from 'states'
1413
import MultisigAddressCreateDialog from 'components/MultisigAddressCreateDialog'
1514
import MultisigAddressInfo from 'components/MultisigAddressInfo'
1615
import SendFromMultisigDialog from 'components/SendFromMultisigDialog'
@@ -39,6 +38,7 @@ import {
3938
DAODeposit,
4039
DAOWithdrawal,
4140
} from 'widgets/Icons/icon'
41+
import { getHeader } from 'services/chain'
4242
import AttentionCloseDialog from 'widgets/Icons/Attention.png'
4343
import { HIDE_BALANCE, NetworkType } from 'utils/const'
4444
import { onEnter } from 'utils/inputDevice'
@@ -148,8 +148,6 @@ const MultisigAddress = () => {
148148
})
149149
const [showDeleteDialog, setShowDeleteDialog] = useState(false)
150150
const { suggestFeeRate } = useGetCountDownAndFeeRateStats()
151-
const clearGeneratedTx = useClearGeneratedTx()
152-
const dispatch = useDispatch()
153151
const [globalAPC, setGlobalAPC] = useState(0)
154152
const [genesisBlockTimestamp, setGenesisBlockTimestamp] = useState<number | undefined>(undefined)
155153
const [notice, setNotice] = useState('')
@@ -257,13 +255,15 @@ const MultisigAddress = () => {
257255
useOnWindowResize(updateTipPosition)
258256

259257
const genesisBlockHash = useMemo(() => networks.find(v => v.id === networkID)?.genesisHash, [networkID, networks])
260-
hooks.useInitData({
261-
clearGeneratedTx,
262-
dispatch,
263-
wallet,
264-
setGenesisBlockTimestamp,
265-
genesisBlockHash,
266-
})
258+
259+
useEffect(() => {
260+
if (genesisBlockHash) {
261+
getHeader(genesisBlockHash)
262+
.then(header => setGenesisBlockTimestamp(+header.timestamp))
263+
.catch(err => console.error(err))
264+
}
265+
}, [])
266+
267267
hooks.useUpdateGlobalAPC({ bestKnownBlockTimestamp, genesisBlockTimestamp, setGlobalAPC })
268268

269269
const fee = `${shannonToCKBFormatter(

0 commit comments

Comments
 (0)