Skip to content

Commit 0086d2a

Browse files
committed
fix: remove upgrade toast
1 parent 9a144d4 commit 0086d2a

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

packages/ui/src/contexts/notification-context/use-reload-when-sw-change.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as React from 'react';
22

3-
import { useToast } from '../../components/toast';
43
import { logger } from '../../utilities/logger';
54
import { checkServiceWorkerCompatibility } from './utilities';
65

76
// export interface IUseReloadWhenSwChangeOptions {}
87

98
export function useReloadWhenSwChange() {
10-
const { showToast } = useToast();
119
React.useEffect(() => {
1210
if (!checkServiceWorkerCompatibility()) {
1311
return;
@@ -38,26 +36,16 @@ export function useReloadWhenSwChange() {
3836
registration.update();
3937

4038
handleNewServiceWorker(registration, () => {
41-
showToast({
42-
type: 'info',
43-
title: 'New version available',
44-
persistent: true,
45-
action: {
46-
label: 'Refresh',
47-
onClick: () => {
48-
if (!registration.waiting) {
49-
// Just to ensure registration.waiting is available before
50-
// calling postMessage()
51-
return;
52-
}
39+
if (!registration.waiting) {
40+
// Just to ensure registration.waiting is available before
41+
// calling postMessage()
42+
return;
43+
}
5344

54-
registration.waiting.postMessage('skipWaiting');
55-
},
56-
},
57-
});
45+
registration.waiting.postMessage('skipWaiting');
5846
});
5947
});
60-
}, [showToast]);
48+
}, []);
6149
}
6250

6351
function handleNewServiceWorker(

0 commit comments

Comments
 (0)