fix: reload when firefox pinned tab becomes visible (#535)
Co-authored-by: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com>
This commit is contained in:
@@ -58,7 +58,6 @@ import { SessionsModalDirective } from './components/SessionsModal';
|
|||||||
import { NoAccountWarningDirective } from './components/NoAccountWarning';
|
import { NoAccountWarningDirective } from './components/NoAccountWarning';
|
||||||
import { NoProtectionsdNoteWarningDirective } from './components/NoProtectionsNoteWarning';
|
import { NoProtectionsdNoteWarningDirective } from './components/NoProtectionsNoteWarning';
|
||||||
|
|
||||||
|
|
||||||
function reloadHiddenFirefoxTab(): boolean {
|
function reloadHiddenFirefoxTab(): boolean {
|
||||||
/**
|
/**
|
||||||
* For Firefox pinned tab issue:
|
* For Firefox pinned tab issue:
|
||||||
@@ -67,14 +66,15 @@ function reloadHiddenFirefoxTab(): boolean {
|
|||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
document.hidden &&
|
document.hidden &&
|
||||||
navigator.userAgent.toLowerCase().includes('firefox') &&
|
navigator.userAgent.toLowerCase().includes('firefox')
|
||||||
!localStorage.getItem('reloading')
|
|
||||||
) {
|
) {
|
||||||
localStorage.setItem('reloading', 'true');
|
document.addEventListener('visibilitychange', () => {
|
||||||
location.reload();
|
if (!document.hidden) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
localStorage.removeItem('reloading');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,10 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (__WEB__) {
|
if (__WEB__) {
|
||||||
startApplication((window as any)._default_sync_server, new BrowserBridge(__VERSION__));
|
startApplication(
|
||||||
|
(window as any)._default_sync_server,
|
||||||
|
new BrowserBridge(__VERSION__)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
(window as any).startApplication = startApplication;
|
(window as any).startApplication = startApplication;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user