fix: reload document once if tab is hidden in firefox
This commit is contained in:
@@ -59,10 +59,35 @@ import { StartApplication } from './startApplication';
|
|||||||
import { Bridge } from './services/bridge';
|
import { Bridge } from './services/bridge';
|
||||||
import { SessionsModalDirective } from './directives/views/sessionsModal';
|
import { SessionsModalDirective } from './directives/views/sessionsModal';
|
||||||
|
|
||||||
|
|
||||||
|
function reloadHiddenFirefoxTab(): boolean {
|
||||||
|
/**
|
||||||
|
* For Firefox pinned tab issue:
|
||||||
|
* When a new browser session is started, and SN is in a pinned tab,
|
||||||
|
* SN exhibits strange behavior until the tab is reloaded.
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
document.hidden &&
|
||||||
|
navigator.userAgent.toLowerCase().includes('firefox') &&
|
||||||
|
!localStorage.getItem('reloading')
|
||||||
|
) {
|
||||||
|
localStorage.setItem('reloading', 'true');
|
||||||
|
location.reload();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem('reloading');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const startApplication: StartApplication = async function startApplication(
|
const startApplication: StartApplication = async function startApplication(
|
||||||
defaultSyncServerHost: string,
|
defaultSyncServerHost: string,
|
||||||
bridge: Bridge
|
bridge: Bridge
|
||||||
) {
|
) {
|
||||||
|
if (reloadHiddenFirefoxTab()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SNLog.onLog = console.log;
|
SNLog.onLog = console.log;
|
||||||
startErrorReporting();
|
startErrorReporting();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user