Fix: read general on proxy initial

This commit is contained in:
Dreamacro 2020-06-25 15:14:56 +08:00
parent c14ed17e14
commit 20ce22fba8
2 changed files with 5 additions and 1 deletions

View File

@ -95,9 +95,12 @@ function ProxyProviders () {
function Proxies () { function Proxies () {
const { proxies } = useProxy() const { proxies } = useProxy()
const { update: updateGeneral } = useGeneral()
const { useTranslation } = useI18n() const { useTranslation } = useI18n()
const { t } = useTranslation('Proxies') const { t } = useTranslation('Proxies')
useSWR('general', updateGeneral)
function handleNotitySpeedTest () { function handleNotitySpeedTest () {
EE.notifySpeedTest() EE.notifySpeedTest()
} }

View File

@ -1,5 +1,6 @@
import { atom, useRecoilState, selector } from 'recoil' import { atom, useRecoilState, selector } from 'recoil'
import get from 'lodash/get' import get from 'lodash/get'
import throttle from 'lodash/throttle'
import { useCallback } from 'react' import { useCallback } from 'react'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
@ -169,7 +170,7 @@ export function useGeneral () {
}) })
} }
return { general: data, update } return { general: data, update: throttle(update, 50) }
} }
export const proxies = atom({ export const proxies = atom({