Expand my Community achievements bar.

SOLVED

first time load issue - aem dynamic modules load issue

Avatar

Level 2

hey everyone,
i need some help on below issue, can you suggest

We have dynamic-modules clientlib and it doesnt load on first hit in the browser, 2nd load onwards, it works fine and keeps working for few hours

do you have some pointer

tried, webpack chunking, code exclusion, dumplibs, nothing is of help

please some explain what is going wrong with clientlib-dynamic-modules

devendrabhn_0-1723568946630.png

 

devendrabhn_1-1723568959122.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @devendrabhn ,

Other clientlibs are getting added via script tag like below which load as page loads

MukeshYadav__0-1723970024113.png

How ever dynamic clientlibs are getting called from js on some condition, which is not  fulfilled at first load.

Either check your condition in debug mode or share the code how your are adding dynamic module cleintlibs  

MukeshYadav__1-1723970800038.pngMukeshYadav__2-1723970907905.png

check and debug these condition in non-minified file I.z.isStorybookMode()

"app-init"),
document.addEventListener("DOMContentLoaded", function() {
I.z.isStorybookMode() || (D(e),

 

Thanks

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @devendrabhn ,

Are you loading clientlib-dynamic-modules based on some condition or from ajax call.

$(document).ready() or DOMContentLoaded should be enough to check if elements loaded

You may remove zero class or implement logic accordingly.

I can see extra zero class attribute on first load.

MukeshYadav__2-1723571844953.png

Second onward load

MukeshYadav__0-1723571460679.png

Thanks

 

 

Avatar

Level 2

Thanks @MukeshYadav_  for replying

this domId is different and is a DOM node, and class zero is not contributing to the issue

If you observe the above SS in my question, or on the site (chrome incongnito mode) and source bundle, the clientlib-dynamic-modules folder itself doesnt show up in 1st attempt to load. In 2nd attempt onwards its loads fine and keep running fine for next few hours

Avatar

Correct answer by
Community Advisor

Hi @devendrabhn ,

Other clientlibs are getting added via script tag like below which load as page loads

MukeshYadav__0-1723970024113.png

How ever dynamic clientlibs are getting called from js on some condition, which is not  fulfilled at first load.

Either check your condition in debug mode or share the code how your are adding dynamic module cleintlibs  

MukeshYadav__1-1723970800038.pngMukeshYadav__2-1723970907905.png

check and debug these condition in non-minified file I.z.isStorybookMode()

"app-init"),
document.addEventListener("DOMContentLoaded", function() {
I.z.isStorybookMode() || (D(e),

 

Thanks