11import { useRegisterSW } from "virtual:pwa-register/react" ;
2- //import { ToastAction, ToastClose } from "@/components/ui/toast";
3- //import { useToast } from "@/components/ui/use-toast";
2+ // import { ToastAction, ToastClose } from "@/components/ui/toast";
3+ // import { useToast } from "@/components/ui/use-toast";
44import { useEffect } from "react" ;
55
66const PERIOD = 30 * 1000 ; // 30 seconds
77
88function UpdatePrompt ( ) {
99 const {
10- needRefresh : [ needRefresh , setNeedRefresh ] ,
11- updateServiceWorker,
10+ needRefresh : [ needRefresh , _setNeedRefresh ] ,
11+ // updateServiceWorker,
1212 } = useRegisterSW ( {
1313 onRegisteredSW : ( _swURL , _registration ) => {
1414 _registration &&
@@ -22,34 +22,34 @@ function UpdatePrompt() {
2222 } ,
2323 } ) ;
2424
25- //const { toast } = useToast();
25+ // const { toast } = useToast();
2626
27- const close = ( ) => setNeedRefresh ( false ) ;
28- const update = ( ) => updateServiceWorker ( true ) ;
27+ // const close = () => setNeedRefresh(false);
28+ // const update = () => updateServiceWorker(true);
2929
3030 // biome-ignore lint/correctness/useExhaustiveDependencies: we don't need to add toast to the dependencies
3131 useEffect ( ( ) => {
3232 if ( needRefresh ) {
33- /* toast({
34- title: "New version 🎉",
35- description: "Reload to update the app.",
36- type: "background",
37- duration: 10000,
38- action: (
39- <>
40- <ToastAction
41- altText="Reload"
42- onClick={async () => {
43- await update();
44- close();
45- }}
46- >
47- Reload
48- </ToastAction>
49- <ToastClose onClick={() => close()}>Dismiss</ToastClose>
50- </>
51- ),
52- });*/
33+ // toast({
34+ // title: "New version 🎉",
35+ // description: "Reload to update the app.",
36+ // type: "background",
37+ // duration: 10000,
38+ // action: (
39+ // <>
40+ // <ToastAction
41+ // altText="Reload"
42+ // onClick={async () => {
43+ // await update();
44+ // close();
45+ // }}
46+ // >
47+ // Reload
48+ // </ToastAction>
49+ // <ToastClose onClick={() => close()}>Dismiss</ToastClose>
50+ // </>
51+ // ),
52+ // });
5353 }
5454 } , [ needRefresh ] ) ;
5555
0 commit comments