@@ -463,7 +463,23 @@ const fileChange = async (event) => {
463463 type: " success" ,
464464 title: t (` myPage.notify.restore.succeed ` ),
465465 });
466- window .location .reload ()
466+
467+ if (" serviceWorker" in navigator ) {
468+ const registrations = await navigator .serviceWorker .getRegistrations ();
469+ for (let registration of registrations ) {
470+ await registration .unregister ();
471+ }
472+ }
473+ if (" caches" in window ) {
474+ const cacheNames = await caches .keys ();
475+ for (let cacheName of cacheNames ) {
476+ await caches .delete (cacheName );
477+ }
478+ }
479+
480+ setTimeout (() => {
481+ window .location .reload ();
482+ }, 1000 );
467483 } else {
468484 throw new Error (' restore failed' )
469485 }
@@ -517,7 +533,22 @@ const sync = async (query: "download" | "upload", options?: { keep?: string[], e
517533 title: t (` myPage.notify.${query }.succeed ` ),
518534 });
519535 if (query === " download" ) {
520- window .location .reload ()
536+ if (" serviceWorker" in navigator ) {
537+ const registrations = await navigator .serviceWorker .getRegistrations ();
538+ for (let registration of registrations ) {
539+ await registration .unregister ();
540+ }
541+ }
542+ if (" caches" in window ) {
543+ const cacheNames = await caches .keys ();
544+ for (let cacheName of cacheNames ) {
545+ await caches .delete (cacheName );
546+ }
547+ }
548+
549+ setTimeout (() => {
550+ window .location .reload ();
551+ }, 1000 );
521552 }
522553 }
523554
0 commit comments