Skip to content

Commit b804aef

Browse files
committed
Update set default fee by poolCategory
1 parent 5d58e5a commit b804aef

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

apps/kyberswap-interface/src/components/FeeTierControl/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { rgba } from 'polished'
2-
import React from 'react'
2+
import React, { useEffect } from 'react'
33
import styled, { css } from 'styled-components'
44

55
import CustomFeeTierInput from './CustomFeeTierInput'
@@ -64,6 +64,10 @@ type Props = {
6464
const FeeTierControl: React.FC<Props> = ({ value, onChange, options = DEFAULT_FEE_OPTIONS, disabled, className }) => {
6565
const [isCustom, setIsCustom] = React.useState(false)
6666

67+
useEffect(() => {
68+
setIsCustom(false)
69+
}, [options])
70+
6771
return (
6872
<Container className={className}>
6973
{options.map(option => (

apps/kyberswap-interface/src/components/ZapCreatePool/CreatePositionModal.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,12 @@ const CreatePositionModal = ({ isOpen, onDismiss, onSubmit }: Props) => {
193193

194194
const feeOptions = useMemo(() => {
195195
const preset = CATEGORY_FEE_PRESETS[poolCategory]
196-
if (preset) {
197-
return preset.options
198-
}
199-
return undefined
196+
return preset?.options
200197
}, [poolCategory])
201198

202199
useEffect(() => {
203200
const preset = CATEGORY_FEE_PRESETS[poolCategory]
204-
if (preset) {
205-
setFee(currentFee => {
206-
if (preset.options.some(option => option === currentFee)) {
207-
return currentFee
208-
}
209-
return preset.defaultFee
210-
})
211-
}
201+
if (preset) setFee(preset.defaultFee)
212202
}, [poolCategory])
213203

214204
return (

0 commit comments

Comments
 (0)