fix(web_ios): Not rendering when the browser back button is pressed.
This commit is contained in:
parent
7ffdaf59c7
commit
6aae56527f
|
@ -6,8 +6,10 @@ import ReactDOM from 'react-dom';
|
|||
import { getJitsiMeetTransport } from '../modules/transport';
|
||||
|
||||
import { App } from './features/app';
|
||||
import { Platform } from './features/base/react';
|
||||
|
||||
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
||||
const OS = Platform.OS;
|
||||
|
||||
/**
|
||||
* Renders the app when the DOM tree has been loaded.
|
||||
|
@ -22,6 +24,23 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
ReactDOM.render(<App />, document.getElementById('react'));
|
||||
});
|
||||
|
||||
// Workaround for the issue when returning to a page with the back button and
|
||||
// the page is loaded from the 'back-forward' cache on iOS which causes nothing
|
||||
// to be rendered.
|
||||
if (OS === 'ios') {
|
||||
window.addEventListener('pageshow', event => {
|
||||
// Detect pages loaded from the 'back-forward' cache
|
||||
// (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
|
||||
if (event.persisted) {
|
||||
// Maybe there is a more graceful approach but in the moment of
|
||||
// writing nothing else resolves the issue. I tried to execute our
|
||||
// DOMContentLoaded handler but it seems that the 'onpageshow' event
|
||||
// is triggered only when 'window.location.reload()' code exists.
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops collecting the logs and disposing the API when the user closes the
|
||||
* page.
|
||||
|
|
Loading…
Reference in New Issue