refactor: simplify useConnectionSetting (#1141)
Some checks are pending
Alpha Build / alpha (macos-latest, aarch64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (macos-latest, x86_64-apple-darwin) (push) Waiting to run
Alpha Build / alpha (windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha (windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, aarch64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, armv7-unknown-linux-gnueabihf) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, i686-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-linux (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (arm64, windows-latest, aarch64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x64, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Alpha Build / alpha-for-fixed-webview2 (x86, windows-latest, i686-pc-windows-msvc) (push) Waiting to run
Alpha Build / Update tag (push) Blocked by required conditions

This commit is contained in:
Sukka 2024-06-07 17:23:53 +08:00 committed by GitHub
parent 5768b01786
commit 7a1f4f9abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 13 deletions

View File

@ -33,7 +33,7 @@
"ahooks": "^3.8.0",
"axios": "^1.7.2",
"dayjs": "1.11.5",
"foxact": "^0.2.34",
"foxact": "^0.2.35",
"i18next": "^23.11.5",
"lodash-es": "^4.17.21",
"meta-json-schema": "1.18.5-alpha4",

View File

@ -53,8 +53,8 @@ importers:
specifier: 1.11.5
version: 1.11.5
foxact:
specifier: ^0.2.34
version: 0.2.34(react@18.3.1)
specifier: ^0.2.35
version: 0.2.35(react@18.3.1)
i18next:
specifier: ^23.11.5
version: 23.11.5
@ -2842,10 +2842,10 @@ packages:
}
engines: { node: ">=12.20.0" }
foxact@0.2.34:
foxact@0.2.35:
resolution:
{
integrity: sha512-9GrB4NPhTjaJ5pzMkfYFatLGgt5LWq3hhVhYR7zG/PaHhtt3ObOzdRVmmO/whh5E7W8JBykiS6RLtnjeLZLSeg==,
integrity: sha512-5e2p34TcBETZTTMhmf4WuljS07lgtv3laimqJer9OGOqYgOpYHgKfR0Cie8Q2IxH1FFhVkm1l0+2W/XL8nBL7Q==,
}
peerDependencies:
react: "*"
@ -6237,7 +6237,7 @@ snapshots:
dependencies:
fetch-blob: 3.2.0
foxact@0.2.34(react@18.3.1):
foxact@0.2.35(react@18.3.1):
dependencies:
client-only: 0.0.1
server-only: 0.0.1

View File

@ -5,10 +5,7 @@ import { Virtuoso } from "react-virtuoso";
import { useTranslation } from "react-i18next";
import { TableChartRounded, TableRowsRounded } from "@mui/icons-material";
import { closeAllConnections } from "@/services/api";
import {
defaultConnectionSetting,
useConnectionSetting,
} from "@/services/states";
import { useConnectionSetting } from "@/services/states";
import { useClashInfo } from "@/hooks/use-clash";
import { BaseEmpty, BasePage } from "@/components/base";
import { useWebsocket } from "@/hooks/use-websocket";
@ -38,8 +35,7 @@ const ConnectionsPage = () => {
const [setting, setSetting] = useConnectionSetting();
const isTableLayout =
(setting || defaultConnectionSetting).layout === "table";
const isTableLayout = setting.layout === "table";
const orderOpts: Record<string, OrderFunc> = {
Default: (list) =>

View File

@ -15,7 +15,7 @@ interface IConnectionSetting {
layout: "table" | "list";
}
export const defaultConnectionSetting: IConnectionSetting = { layout: "table" };
const defaultConnectionSetting: IConnectionSetting = { layout: "table" };
export const useConnectionSetting = () =>
useLocalStorage<IConnectionSetting>(