Clientlib is pulled in twice | Community
Skip to main content
Level 3
December 6, 2016

Clientlib is pulled in twice

  • December 6, 2016
  • 2 replies
  • 5212 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

smacdonald2008
Level 10
December 6, 2016

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. 

Level 3
December 7, 2016

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.

smacdonald2008
Level 10
December 7, 2016

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

Nupur_Jain
Adobe Employee
Adobe Employee
December 7, 2016

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

Level 3
December 7, 2016

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