Fix frozen layout when proload task fails

This commit is contained in:
Alexander Zinchuk 2021-05-31 19:50:16 +03:00
parent 6dd0249541
commit 5eb2e77c2e

View File

@ -92,9 +92,17 @@ const UiLoader: FC<OwnProps & StateProps & DispatchProps> = ({
useEffect(() => {
let timeout: number | undefined;
const safePreload = async () => {
try {
await preloadTasks[page]();
} catch (err) {
// Do nothing
}
};
Promise.race([
pause(MAX_PRELOAD_DELAY),
preloadTasks[page](),
safePreload(),
]).then(() => {
markReady();
setIsUiReady({ uiReadyState: 1 });