1
0
forked from mirror/misskey

fix(frontend): サーバーサイドbootでエラー画面の描画時にDOMが初期化できていないことがあるのを修正 (#14139)

This commit is contained in:
かっこかり 2024-07-07 09:56:09 +09:00 committed by GitHub
parent fe852920c3
commit 984d582796
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,8 @@
let forceError = localStorage.getItem('forceError'); let forceError = localStorage.getItem('forceError');
if (forceError != null) { if (forceError != null) {
renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.') renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.');
return;
} }
//#region Detect language & fetch translations //#region Detect language & fetch translations
@ -155,7 +156,12 @@
document.head.appendChild(css); document.head.appendChild(css);
} }
function renderError(code, details) { async function renderError(code, details) {
// Cannot set property 'innerHTML' of null を回避
if (document.readyState === 'loading') {
await new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve));
}
let errorsElement = document.getElementById('errors'); let errorsElement = document.getElementById('errors');
if (!errorsElement) { if (!errorsElement) {
@ -314,6 +320,6 @@
#errorInfo { #errorInfo {
width: 50%; width: 50%;
} }
`) }`)
} }
})(); })();