Skip to content

Commit

Permalink
Checking if Ims is already initialized before loading it (#2802)
Browse files Browse the repository at this point in the history
* Checking if Ims is already initialized

* Moving the check to global navigation

* Lint fix
  • Loading branch information
bandana147 authored Sep 3, 2024
1 parent 7216452 commit 318f2e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,15 @@ class Gnav {
isDesktop.addEventListener('change', closeAllDropdowns);
}, 'Error in global navigation init', 'errorType=error,module=gnav');

ims = async () => loadIms()
ims = async () => (window.adobeIMS?.initialized ? this.imsReady() : loadIms()
.then(() => this.imsReady())
.catch((e) => {
if (e?.message === 'IMS timeout') {
window.addEventListener('onImsLibInstance', () => this.imsReady());
return;
}
lanaLog({ message: 'GNAV: Error with IMS', e, tags: 'errorType=info,module=gnav' });
});
}));

decorateTopNav = () => {
this.elements.mobileToggle = this.decorateToggle();
Expand Down

0 comments on commit 318f2e8

Please sign in to comment.