Skip to content

Commit

Permalink
fix async rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed Apr 23, 2024
1 parent 5e7f13e commit 99b3ca7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/src/js/lib/executeScriptElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function executeScriptElements(containerElement) {

if (!loaded) {
loaded = true;
window.addEventListener('DOMContentLoaded', (event) => {
window.addEventListener('load', (event) => {
const scripts = document.querySelectorAll('script');
for (const s of scripts) {
const name = getScriptName(s);
Expand Down
3 changes: 3 additions & 0 deletions assets/src/js/lib/loadAsyncView.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ function renderBody(target, body, template) {
target,
template,
};
// Update async elements
const event = new CustomEvent('async', { detail });
window.dispatchEvent(event);

// Process async views
if (template) {
const event = new CustomEvent('async:' + template, { detail });
window.dispatchEvent(event);
Expand Down

0 comments on commit 99b3ca7

Please sign in to comment.