Skip to content

Commit b8332f7

Browse files
committed
fix: update AppUpdateModal to manage open state with useEffect
1 parent 90827a0 commit b8332f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/features/updater/AppUpdate.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from "react";
1+
import { useEffect, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import { NeedRestart } from "@/components/shared/System";
44
import {
@@ -43,10 +43,16 @@ function AppUpdateModal({
4343
install: ReturnType<typeof useUpdater>["install"];
4444
}) {
4545
const { t } = useTranslation();
46-
const [open, setOpen] = useState(!!meta);
46+
const [open, setOpen] = useState(false);
47+
48+
useEffect(() => {
49+
if (meta) {
50+
setOpen(true);
51+
}
52+
}, [meta]);
4753

4854
return (
49-
<AlertDialog open={open}>
55+
<AlertDialog open={open} onOpenChange={setOpen}>
5056
<AlertDialogContent className="text-foreground">
5157
<AlertDialogHeader>
5258
<AlertDialogTitle className="text-foreground">

0 commit comments

Comments
 (0)