1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 20:39:08 +01:00

Fix React warning about missing key in AwaitingSwap (#9655)

The `AwaitingSwap` component was emitting a React warning when rendered
because a component was being rendered in an array without having a
`key` prop set.

A key has been added to the `CountdownTimer` component, which is passed
into the translation helper in an array. The warning no longer appears.
This commit is contained in:
Mark Stacey 2020-10-20 10:36:15 -02:30 committed by GitHub
parent f4838194d6
commit d43738448c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,14 @@ export default function AwaitingSwap ({
let countdownText let countdownText
if (timeRemainingIsNumber && !timeRemainingExpired && tradeTxData?.submittedTime) { if (timeRemainingIsNumber && !timeRemainingExpired && tradeTxData?.submittedTime) {
countdownText = <CountdownTimer timeStarted={tradeTxData?.submittedTime} timerBase={estimatedTransactionWaitTime} timeOnly /> countdownText = (
<CountdownTimer
key="countdown-timer"
timeStarted={tradeTxData?.submittedTime}
timerBase={estimatedTransactionWaitTime}
timeOnly
/>
)
} else if (tradeTxData?.submittedTime) { } else if (tradeTxData?.submittedTime) {
countdownText = t('swapsAlmostDone') countdownText = t('swapsAlmostDone')
} else { } else {