Skip to content

Commit

Permalink
fix: remove upgrade toast
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n committed Oct 30, 2024
1 parent 9a144d4 commit 0086d2a
Showing 1 changed file with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as React from 'react';

import { useToast } from '../../components/toast';
import { logger } from '../../utilities/logger';
import { checkServiceWorkerCompatibility } from './utilities';

// export interface IUseReloadWhenSwChangeOptions {}

export function useReloadWhenSwChange() {
const { showToast } = useToast();
React.useEffect(() => {
if (!checkServiceWorkerCompatibility()) {
return;
Expand Down Expand Up @@ -38,26 +36,16 @@ export function useReloadWhenSwChange() {
registration.update();

handleNewServiceWorker(registration, () => {
showToast({
type: 'info',
title: 'New version available',
persistent: true,
action: {
label: 'Refresh',
onClick: () => {
if (!registration.waiting) {
// Just to ensure registration.waiting is available before
// calling postMessage()
return;
}
if (!registration.waiting) {
// Just to ensure registration.waiting is available before
// calling postMessage()
return;
}

registration.waiting.postMessage('skipWaiting');
},
},
});
registration.waiting.postMessage('skipWaiting');
});
});
}, [showToast]);
}, []);
}

function handleNewServiceWorker(
Expand Down

0 comments on commit 0086d2a

Please sign in to comment.