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