Revert "Refactor components to remove forwardRef and simplify props handling"

This reverts commit 1cd013fb94.
This commit is contained in:
Tunglies
2025-09-30 18:13:02 +08:00
parent 14288568bf
commit 8a4f2de887
25 changed files with 1474 additions and 1399 deletions

View File

@@ -9,7 +9,7 @@ import {
TextField,
} from "@mui/material";
import { useLockFn, useRequest } from "ahooks";
import { useImperativeHandle, useState } from "react";
import { forwardRef, useImperativeHandle, useState } from "react";
import { useTranslation } from "react-i18next";
import { BaseDialog, Switch } from "@/components/base";
@@ -30,12 +30,10 @@ interface ClashPortViewerRef {
const generateRandomPort = () =>
Math.floor(Math.random() * (65535 - 1025 + 1)) + 1025;
export const ClashPortViewer = ({
ref,
...props
}: ClashPortViewerProps & {
ref?: React.RefObject<ClashPortViewerRef | null>;
}) => {
export const ClashPortViewer = forwardRef<
ClashPortViewerRef,
ClashPortViewerProps
>((props, ref) => {
const { t } = useTranslation();
const { clashInfo, patchInfo } = useClashInfo();
const { verge, patchVerge } = useVerge();
@@ -350,4 +348,4 @@ export const ClashPortViewer = ({
</List>
</BaseDialog>
);
};
});