If unable to load main bundle, retry after 3 seconds
Summary: If we fail to load the main js bundle, retry after 3 seconds. Reviewed By: aigoncharov Differential Revision: D50732857 fbshipit-source-id: b19ea165776f8105d724e586b1bed20bf1f5178c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2c1e814264
commit
34bbd41547
@@ -201,9 +201,19 @@
|
||||
function init() {
|
||||
const script = document.createElement('script');
|
||||
script.src = window.flipperConfig.entryPoint;
|
||||
|
||||
script.onerror = (e) => {
|
||||
showMessage('Failed to load entry point. Check Chrome Dev Tools console for more info.');
|
||||
const retry = (retries) => {
|
||||
showMessage(`Failed to load entry point. Check Chrome Dev Tools console for more info. Retrying in: ${retries}`);
|
||||
retries -= 1;
|
||||
if (retries < 0) {
|
||||
window.location.reload();
|
||||
}
|
||||
else {
|
||||
setTimeout(() => retry(retries), 1000);
|
||||
}
|
||||
}
|
||||
|
||||
retry(3);
|
||||
};
|
||||
|
||||
document.body.appendChild(script);
|
||||
|
||||
Reference in New Issue
Block a user