Skip to content

Commit

Permalink
fix: update proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso authored and Zephyruso committed Sep 2, 2023
1 parent 8d46254 commit 467d0bc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ import {
For,
ParentComponent,
Show,
createEffect,
createMemo,
createSignal,
onMount,
} from 'solid-js'
import { twMerge } from 'tailwind-merge'
import { LANG, ROUTE } from '~/config/enum'
import { themes } from '~/constants'
import { setCurTheme, setSelectedEndpoint } from '~/signals'
import {
endpoint,
selectedEndpoint,
setCurTheme,
setSelectedEndpoint,
} from '~/signals'
import { useProxies } from '~/signals/proxies'

const Nav: ParentComponent<{ href: string; tooltip: string }> = ({
Expand Down Expand Up @@ -74,10 +79,13 @@ const ThemeSwitcher = () => (

export const Header = () => {
const [t, { locale }] = useI18n()
const { updateProxy, proxyProviders } = useProxies()
const { proxyProviders } = useProxies()

onMount(() => {
updateProxy()
createEffect(() => {
// Need fix: useRequest is not reactive so we need to useProxies again or request wont have endpoint
if (selectedEndpoint() && endpoint()) {
useProxies().updateProxy()
}
})

const navs = createMemo(() => {
Expand Down

0 comments on commit 467d0bc

Please sign in to comment.