Skip to content

Commit

Permalink
fix: service viewer ref
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi committed Nov 21, 2022
1 parent 020bd12 commit 781c67b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/setting/mods/service-viewer.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -8,7 +9,6 @@ import {
uninstallService,
patchVergeConfig,
} from "@/services/cmds";
import { forwardRef, useState } from "react";
import { BaseDialog, DialogRef, Notice } from "@/components/base";

interface Props {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 781c67b

Please sign in to comment.