Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Clientlib is pulled in twice

Avatar

Level 3

I've taken the adhocassetshare folder from /libs and made a copy inside /apps so that I now have " apps/dam/gui/components/admin/adhocassetshare "

 

Inside of /apps/dam/gui/components/admin/adhocassetshare/clientlibs/landingpage/js/landingpage.js I put console.log('test'); inside the first few lines, like so:

(function (document, $) { "use strict"; console.log('test'); function createModal(modalId, modalHeader) {

 

When I view the browser console, I see two "tests", one from shareembedded.js:93229, and another from shareembedded.js:93473 

For some reason, this file appears to be included twice. Is there any way I can find the cause and stop this from happening?

7 Replies

Avatar

Level 10

Try changing the name of the clientlib in your overlayed component and ensure you update the name of it in the component - there should be no link back to the original client lib. 

Avatar

Level 3

smacdonald2008 wrote...

Try changing the name of the clientlib in your overlayed component and ensure you update the name of it in the component - there should be no link back to the original client lib. 

 

I'm not sure what you're referring to. I don't think I have an overlayed component. I just copied the folder and structure from /libs into /apps and begun modifying my copy in apps.

Also, if it were hitting the original client lib, it shouldn't be logging "console.log('test')", since that code only appears in the version in /apps, right?

Avatar

Level 3

smacdonald2008 wrote...

Try changing the name of the clientlib in your overlayed component and ensure you update the name of it in the component - there should be no link back to the original client lib. 

 

 

I changed the name of the file

/apps/dam/gui/components/admin/adhocassetshare/clientlibs/landingpage/js/landingpage.js

to

/apps/dam/gui/components/admin/adhocassetshare/clientlibs/landingpage/js/landingpage2.js

I also changed the reference inside of js.txt, and now everything works as expected. I was confused about what you wanted me to rename at first.

 

EDIT: Actually, I spoke too soon. Instead of embedding landingpage.js twice, it now embeds landingpage2.js from my copy in apps/, as well as the original landingpage.js from libs/, causing undesired behavior

So if I'm following your instructions correctly, this doesn't seem to resolve the problem.

Avatar

Level 10

Name your new clientlib category something unique like foo. Then reference that unique name in your component. It will not load other clientlibs.  

Avatar

Level 3

smacdonald2008 wrote...

Name your new clientlib category something unique like foo. Then reference that unique name in your component. It will not load other clientlibs.  

 

 

I renamed the share page to something unique (dam.gui.adhocshare.sharepagecustom), but the problem persists.

 

Pictured: the categories property of /apps/dam/gui/components/admin/adhocassetshare/clientlibs/landingpage

Avatar

Community Advisor

What I can possibly think of is that you have copied the content from libs to apps i.e now there are two clientlib folders

1. /libs/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview

2. /apps/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview

with category : embeddedadhocassetsharepreview

This category embed your landing page clientlib : dam.gui.adhocshare.sharepage

Somewhere in your page you are including clientlib :  embeddedadhocassetsharepreview

now, since there are two clientlib folder 'shareembeddedpreview' ,both embedding the landing page clientlib, that is how you are getting same console code twice in actual  shareembedded.js created.

Hope this helps!

 

Thanks,

Nupur

Avatar

Level 3

nupurj17891248 wrote...

What I can possibly think of is that you have copied the content from libs to apps i.e now there are two clientlib folders

1. /libs/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview

2. /apps/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview

with category : embeddedadhocassetsharepreview

This category embed your landing page clientlib : dam.gui.adhocshare.sharepage

Somewhere in your page you are including clientlib :  embeddedadhocassetsharepreview

now, since there are two clientlib folder 'shareembeddedpreview' ,both embedding the landing page clientlib, that is how you are getting same console code twice in actual  shareembedded.js created.

Hope this helps!

 

Thanks,

Nupur

 

I've deleted everything I don't need for this customization. "/apps/dam/gui/components/admin/adhocassetshare/clientlibs/shareembeddedpreview" is now gone.

The two files I need to edit are:


/apps/dam/gui/components/admin/adhocassetshare/childasset/link.jsp
/apps/dam/gui/components/admin/adhocassetshare/clientlibs/landingpage/js/landingpage.js

My apps directory looks like this:

The problem is still happening