chore(deps): update dependency eslint-plugin-react-hooks to v6 (#4940)
* chore(deps): update dependency eslint-plugin-react-hooks to v6 * fix: update ESLint configuration to use correct imports and recommended settings * chore: clean up unused code and improve readability across components --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
import { ExpandMoreRounded } from "@mui/icons-material";
|
||||
import {
|
||||
Box,
|
||||
Snackbar,
|
||||
Alert,
|
||||
Chip,
|
||||
Stack,
|
||||
Typography,
|
||||
IconButton,
|
||||
Collapse,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Divider,
|
||||
Button,
|
||||
} from "@mui/material";
|
||||
import { ArchiveOutlined, ExpandMoreRounded } from "@mui/icons-material";
|
||||
import { useLockFn } from "ahooks";
|
||||
import { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
||||
import useSWR from "swr";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useProxySelection } from "@/hooks/use-proxy-selection";
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
@@ -34,8 +30,8 @@ import { BaseEmpty } from "../base";
|
||||
import { ScrollTopButton } from "../layout/scroll-top-button";
|
||||
|
||||
import { ProxyChain } from "./proxy-chain";
|
||||
import { ProxyRender } from "./proxy-render";
|
||||
import { ProxyGroupNavigator } from "./proxy-group-navigator";
|
||||
import { ProxyRender } from "./proxy-render";
|
||||
import { useRenderList } from "./use-render-list";
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import React, {
|
||||
createContext,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
} from "react";
|
||||
import React, { createContext, use, useEffect, useMemo, useRef } from "react";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useClashInfo } from "@/hooks/use-clash";
|
||||
@@ -589,14 +583,12 @@ export const AppDataProvider = ({
|
||||
refreshAll,
|
||||
]);
|
||||
|
||||
return (
|
||||
<AppDataContext.Provider value={value}>{children}</AppDataContext.Provider>
|
||||
);
|
||||
return <AppDataContext value={value}>{children}</AppDataContext>;
|
||||
};
|
||||
|
||||
// 自定义Hook访问全局数据
|
||||
export const useAppData = () => {
|
||||
const context = useContext(AppDataContext);
|
||||
const context = use(AppDataContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error("useAppData必须在AppDataProvider内使用");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { createContext, useCallback, useContext, useState } from "react";
|
||||
import React, { createContext, useCallback, use, useState } from "react";
|
||||
|
||||
interface ChainProxyContextType {
|
||||
isChainMode: boolean;
|
||||
@@ -26,7 +26,7 @@ export const ChainProxyProvider = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ChainProxyContext.Provider
|
||||
<ChainProxyContext
|
||||
value={{
|
||||
isChainMode,
|
||||
setChainMode,
|
||||
@@ -35,12 +35,12 @@ export const ChainProxyProvider = ({
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ChainProxyContext.Provider>
|
||||
</ChainProxyContext>
|
||||
);
|
||||
};
|
||||
|
||||
export const useChainProxy = () => {
|
||||
const context = useContext(ChainProxyContext);
|
||||
const context = use(ChainProxyContext);
|
||||
if (!context) {
|
||||
throw new Error("useChainProxy must be used within a ChainProxyProvider");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user