chore: upgrade to react 19

This commit is contained in:
wonfen
2025-05-14 10:47:33 +08:00
parent d1a2bd78d7
commit 1993e5dd51
7 changed files with 1245 additions and 1233 deletions

View File

@@ -30,7 +30,7 @@
"@emotion/styled": "^11.14.0", "@emotion/styled": "^11.14.0",
"@juggle/resize-observer": "^3.4.0", "@juggle/resize-observer": "^3.4.0",
"@mui/icons-material": "^7.0.2", "@mui/icons-material": "^7.0.2",
"@mui/lab": "7.0.0-beta.11", "@mui/lab": "7.0.0-beta.12",
"@mui/material": "^7.0.2", "@mui/material": "^7.0.2",
"@mui/x-data-grid": "^8.2.0", "@mui/x-data-grid": "^8.2.0",
"@tauri-apps/api": "2.5.0", "@tauri-apps/api": "2.5.0",
@@ -60,16 +60,15 @@
"monaco-yaml": "^5.3.1", "monaco-yaml": "^5.3.1",
"nanoid": "^5.1.5", "nanoid": "^5.1.5",
"peggy": "^5.0.0", "peggy": "^5.0.0",
"react": "^18.3.1", "react": "19.1.0",
"react-dom": "^18.3.1", "react-dom": "19.1.0",
"react-error-boundary": "^4.1.2", "react-error-boundary": "6.0.0",
"react-hook-form": "^7.54.2", "react-hook-form": "^7.54.2",
"react-i18next": "^13.5.0", "react-i18next": "15.5.1",
"react-markdown": "^9.1.0", "react-markdown": "10.1.0",
"react-monaco-editor": "^0.56.2", "react-monaco-editor": "0.58.0",
"react-router-dom": "^6.30.0", "react-router-dom": "7.6.0",
"react-transition-group": "^4.4.5", "react-virtuoso": "^4.12.7",
"react-virtuoso": "^4.12.5",
"recharts": "^2.15.1", "recharts": "^2.15.1",
"sockette": "^2.0.6", "sockette": "^2.0.6",
"swr": "^2.3.3", "swr": "^2.3.3",
@@ -83,11 +82,10 @@
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/react": "^18.3.18", "@types/react": "19.1.4",
"@types/react-dom": "^18.3.5", "@types/react-dom": "19.1.5",
"@types/react-transition-group": "^4.4.12",
"@vitejs/plugin-legacy": "^6.0.2", "@vitejs/plugin-legacy": "^6.0.2",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "4.4.1",
"adm-zip": "^0.5.16", "adm-zip": "^0.5.16",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"https-proxy-agent": "^7.0.6", "https-proxy-agent": "^7.0.6",

2429
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -97,7 +97,7 @@ export const EditorViewer = <T extends Language>(props: Props<T>) => {
onClose, onClose,
} = props; } = props;
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>(); const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>(undefined);
const prevData = useRef<string | undefined>(""); const prevData = useRef<string | undefined>("");
const currData = useRef<string | undefined>(""); const currData = useRef<string | undefined>("");

View File

@@ -12,7 +12,7 @@ export const FileInput = (props: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
// file input // file input
const inputRef = useRef<any>(); const inputRef = useRef<any>(undefined);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [fileName, setFileName] = useState(""); const [fileName, setFileName] = useState("");

View File

@@ -117,7 +117,7 @@ const LetterItem = memo(
top: 0, top: 0,
right: 0, right: 0,
}); });
const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout>>(); const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout>>(undefined);
const updateTooltipPosition = useCallback(() => { const updateTooltipPosition = useCallback(() => {
if (!letterRef.current) return; if (!letterRef.current) return;

View File

@@ -29,13 +29,13 @@ export function GuardState<T>(props: Props<T>) {
const lockRef = useRef(false); const lockRef = useRef(false);
const saveRef = useRef(value); const saveRef = useRef(value);
const lastRef = useRef(0); const lastRef = useRef(0);
const timeRef = useRef<any>(); const timeRef = useRef<any>(undefined);
if (!isValidElement(children)) { if (!isValidElement(children)) {
return children as any; return children as any;
} }
const childProps = { ...children.props }; const childProps = { ...(children.props as Record<string, any>) };
childProps[valueProps] = value; childProps[valueProps] = value;
childProps[onChangeProps] = async (...args: any[]) => { childProps[onChangeProps] = async (...args: any[]) => {

View File

@@ -24,7 +24,6 @@ import "dayjs/locale/ru";
import "dayjs/locale/zh-cn"; import "dayjs/locale/zh-cn";
import { getPortableFlag } from "@/services/cmds"; import { getPortableFlag } from "@/services/cmds";
import React from "react"; import React from "react";
import { TransitionGroup, CSSTransition } from "react-transition-group";
import { useListen } from "@/hooks/use-listen"; import { useListen } from "@/hooks/use-listen";
import { listen } from "@tauri-apps/api/event"; import { listen } from "@tauri-apps/api/event";
import { useClashInfo } from "@/hooks/use-clash"; import { useClashInfo } from "@/hooks/use-clash";
@@ -391,15 +390,9 @@ const Layout = () => {
{OS !== "macos" && <LayoutControl />} {OS !== "macos" && <LayoutControl />}
</div> </div>
<TransitionGroup className="the-content"> <div className="the-content">
<CSSTransition
key={location.pathname}
timeout={300}
classNames="page"
>
{React.cloneElement(routersEles, { key: location.pathname })} {React.cloneElement(routersEles, { key: location.pathname })}
</CSSTransition> </div>
</TransitionGroup>
</div> </div>
</Paper> </Paper>
</ThemeProvider> </ThemeProvider>