From b07647c549a26868af6c27cc6e8c25501c80b3b3 Mon Sep 17 00:00:00 2001 From: YetAnotherZephyruso <176294927+YetAnotherZephyruso@users.noreply.github.com> Date: Sat, 10 Aug 2024 01:33:12 +0800 Subject: [PATCH] fix: flickering issue of the config page under sing-box (#900) --- src/components/ProxyPreviewBar.tsx | 2 +- src/helpers/global.ts | 4 ---- src/pages/Config.tsx | 25 +++++++++++-------------- src/signals/version.ts | 9 +++++++++ 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 src/signals/version.ts diff --git a/src/components/ProxyPreviewBar.tsx b/src/components/ProxyPreviewBar.tsx index 6f68d09..72b506b 100644 --- a/src/components/ProxyPreviewBar.tsx +++ b/src/components/ProxyPreviewBar.tsx @@ -41,7 +41,7 @@ export const ProxyPreviewBar = (props: { return (
-
+
{ - return version.includes('sing-box') -} - export const transformEndpointURL = (url: string) => /^https?:\/\//.test(url) ? url : `${window.location.protocol}//${url}` diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 141cad2..27c2b05 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -5,7 +5,6 @@ import { toast } from 'solid-toast' import { z } from 'zod' import { fetchBackendConfigAPI, - fetchBackendVersionAPI, flushFakeIPDataAPI, flushingFakeIPData, isUpdateAvailableAPI, @@ -23,7 +22,6 @@ import { } from '~/apis' import { Button, ConfigTitle } from '~/components' import { LANG, MODE_OPTIONS, ROUTES, themes } from '~/constants' -import { isSingBox } from '~/helpers' import { locale, setLocale, useI18n } from '~/i18n' import { autoSwitchTheme, @@ -38,6 +36,11 @@ import { useRequest, useTwemoji, } from '~/signals' +import { + backendVersion, + isSingBox, + updateBackendVersion, +} from '~/signals/version' import type { DNSQuery } from '~/types' const dnsQueryFormSchema = z.object({ @@ -109,9 +112,7 @@ const configFormSchema = z.object({ 'mixed-port': z.number(), }) -const ConfigForm: Component<{ backendVersion: Accessor }> = ({ - backendVersion, -}) => { +const ConfigForm = () => { const [t] = useI18n() const portList = [ @@ -192,7 +193,7 @@ const ConfigForm: Component<{ backendVersion: Accessor }> = ({ - +
{(item) => ( @@ -344,7 +345,7 @@ const ConfigForm: Component<{ backendVersion: Accessor }> = ({ {t('restartCore')} - +