From 781c67b31afaf353ca2c44c1a542769be90a94fd Mon Sep 17 00:00:00 2001
From: GyDi <zzzgydi@gmail.com>
Date: Mon, 21 Nov 2022 23:02:48 +0800
Subject: [PATCH] fix: service viewer ref

---
 src/components/setting/mods/service-viewer.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/components/setting/mods/service-viewer.tsx b/src/components/setting/mods/service-viewer.tsx
index 9052559..40e4247 100644
--- a/src/components/setting/mods/service-viewer.tsx
+++ b/src/components/setting/mods/service-viewer.tsx
@@ -1,4 +1,5 @@
 import useSWR from "swr";
+import { forwardRef, useImperativeHandle, useState } from "react";
 import { useLockFn } from "ahooks";
 import { useTranslation } from "react-i18next";
 import { Button, Stack, Typography } from "@mui/material";
@@ -8,7 +9,6 @@ import {
   uninstallService,
   patchVergeConfig,
 } from "@/services/cmds";
-import { forwardRef, useState } from "react";
 import { BaseDialog, DialogRef, Notice } from "@/components/base";
 
 interface Props {
@@ -27,6 +27,11 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
     { revalidateIfStale: false, shouldRetryOnError: false }
   );
 
+  useImperativeHandle(ref, () => ({
+    open: () => setOpen(true),
+    close: () => setOpen(false),
+  }));
+
   const state = status != null ? status : "pending";
 
   const onInstall = useLockFn(async () => {
-- 
GitLab