mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +08:00
fix debounce
This commit is contained in:
parent
d3bbb3bda7
commit
52b058e0c7
@ -33,7 +33,13 @@ const Settings: React.FC = () => {
|
||||
appTheme = 'system'
|
||||
} = appConfig || {}
|
||||
const [url, setUrl] = useState(delayTestUrl)
|
||||
const setUrlDebounce = debounce((v: string) => {
|
||||
patchAppConfig({ delayTestUrl: v })
|
||||
}, 500)
|
||||
const [ua, setUa] = useState(userAgent)
|
||||
const setUaDebounce = debounce((v: string) => {
|
||||
patchAppConfig({ userAgent: v })
|
||||
}, 500)
|
||||
|
||||
return (
|
||||
<BasePage
|
||||
@ -112,9 +118,7 @@ const Settings: React.FC = () => {
|
||||
placeholder="默认 clash-meta"
|
||||
onValueChange={(v) => {
|
||||
setUa(v)
|
||||
debounce(() => {
|
||||
patchAppConfig({ userAgent: v })
|
||||
}, 2000)
|
||||
setUaDebounce(v)
|
||||
}}
|
||||
></Input>
|
||||
</SettingItem>
|
||||
@ -126,9 +130,7 @@ const Settings: React.FC = () => {
|
||||
placeholder="默认https://www.gstatic.com/generate_204"
|
||||
onValueChange={(v) => {
|
||||
setUrl(v)
|
||||
debounce(() => {
|
||||
patchAppConfig({ delayTestUrl: v })
|
||||
}, 2000)
|
||||
setUrlDebounce(v)
|
||||
}}
|
||||
></Input>
|
||||
</SettingItem>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user