File tree Expand file tree Collapse file tree 1 file changed +7
-19
lines changed
packages/ui/src/contexts/notification-context Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
3
- import { useToast } from '../../components/toast' ;
4
3
import { logger } from '../../utilities/logger' ;
5
4
import { checkServiceWorkerCompatibility } from './utilities' ;
6
5
7
6
// export interface IUseReloadWhenSwChangeOptions {}
8
7
9
8
export function useReloadWhenSwChange ( ) {
10
- const { showToast } = useToast ( ) ;
11
9
React . useEffect ( ( ) => {
12
10
if ( ! checkServiceWorkerCompatibility ( ) ) {
13
11
return ;
@@ -38,26 +36,16 @@ export function useReloadWhenSwChange() {
38
36
registration . update ( ) ;
39
37
40
38
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
+ }
53
44
54
- registration . waiting . postMessage ( 'skipWaiting' ) ;
55
- } ,
56
- } ,
57
- } ) ;
45
+ registration . waiting . postMessage ( 'skipWaiting' ) ;
58
46
} ) ;
59
47
} ) ;
60
- } , [ showToast ] ) ;
48
+ } , [ ] ) ;
61
49
}
62
50
63
51
function handleNewServiceWorker (
You can’t perform that action at this time.
0 commit comments