Skip to content

Commit

Permalink
fix: react key warning fix
Browse files Browse the repository at this point in the history
  • Loading branch information
teebszet committed Feb 2, 2024
1 parent 5e00bbb commit 3e08755
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/app/ui-components/selectFeeRate/feeSelectPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function FeeSelectPopup({
calculateTotalFee();
}, [baseToFiat, customValue, getFeeForFeeRate]);

const handleClick = (newRate) => () => {
const handleClick = (newRate: string) => () => {
setFeeRate(newRate);
onClose();
};
Expand Down Expand Up @@ -158,20 +158,6 @@ function FeeSelectPopup({
return { knownRates: rates, selected: selectedRate };
}, [feeRates, currentFeeRate]);

const renderFeeItem = (priority: FeePriority, rate: number) => (
<FeeItem
priority={priority}
feeRate={rate}
onClick={handleClick(rate.toString())}
selected={priority === selected}
feeUnits={feeUnits}
feeRateUnits={feeRateUnits}
fiatUnit={fiatUnit}
baseToFiat={baseToFiat}
getFeeForFeeRate={getFeeForFeeRate}
/>
);

const renderFeeSelectors = () => {
if (useCustom) {
const onCustomValueChange = (e: ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -264,7 +250,20 @@ function FeeSelectPopup({

return (
<FeePrioritiesContainer>
{knownRates.map((rate) => renderFeeItem(rate, feeRates[rate]!))}
{knownRates.map((rate) => (
<FeeItem
key={rate}
priority={rate}
feeRate={feeRates[rate]!}
onClick={handleClick(feeRates[rate]!.toString())}
selected={rate === selected}
feeUnits={feeUnits}
feeRateUnits={feeRateUnits}
fiatUnit={fiatUnit}
baseToFiat={baseToFiat}
getFeeForFeeRate={getFeeForFeeRate}
/>
))}
<FeeItemContainer $isSelected={!selected} onClick={() => setUseCustom(true)}>
<RotatedFaders size={20} color={theme.colors.tangerine} />
<TextRow>
Expand Down

0 comments on commit 3e08755

Please sign in to comment.