Skip to content

Commit

Permalink
fix(frontend): サーバーサイドbootでエラー画面の描画時にDOMが初期化できていないことがあるのを修正 (#14139)
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored Jul 7, 2024
1 parent fe85292 commit 984d582
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/backend/src/server/web/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

let forceError = localStorage.getItem('forceError');
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
Expand Down Expand Up @@ -155,7 +156,12 @@
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');

if (!errorsElement) {
Expand Down Expand Up @@ -314,6 +320,6 @@
#errorInfo {
width: 50%;
}
`)
}`)
}
})();

0 comments on commit 984d582

Please sign in to comment.