Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking if Ims is already initialized before loading it #2802

Merged
merged 3 commits into from
Sep 3, 2024
Merged

Conversation

bandana147
Copy link
Contributor

@bandana147 bandana147 commented Aug 29, 2024

@bandana147 bandana147 added the needs-verification PR requires E2E testing by a reviewer label Aug 29, 2024
@bandana147 bandana147 requested a review from a team as a code owner August 29, 2024 06:01
Copy link
Contributor

aem-code-sync bot commented Aug 29, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link
Contributor

aem-code-sync bot commented Aug 29, 2024

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.90%. Comparing base (d90dcc0) to head (e6de6eb).
Report is 24 commits behind head on stage.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #2802      +/-   ##
==========================================
- Coverage   95.90%   95.90%   -0.01%     
==========================================
  Files         173      173              
  Lines       45842    46075     +233     
==========================================
+ Hits        43967    44187     +220     
- Misses       1875     1888      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spadmasa spadmasa self-assigned this Aug 29, 2024
@spadmasa spadmasa added verified PR has been E2E tested by a reviewer and removed needs-verification PR requires E2E testing by a reviewer labels Aug 29, 2024
libs/utils/utils.js Outdated Show resolved Hide resolved
Copy link
Contributor

@mokimo mokimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized imsLoaded = window.adobeIMS?.initialized; will be a boolean rather than promise, if someone calls loadIms.then() we'd return a boolean and have JS errors trying to access true.then

Would be great to change the return value to a promise that resolves and write a unit test for this scenario.

@spadmasa spadmasa removed the verified PR has been E2E tested by a reviewer label Aug 29, 2024
@bandana147
Copy link
Contributor Author

I just realized imsLoaded = window.adobeIMS?.initialized; will be a boolean rather than promise, if someone calls loadIms.then() we'd return a boolean and have JS errors trying to access true.then

Would be great to change the return value to a promise that resolves and write a unit test for this scenario.

Updated the code.

Copy link
Contributor

@mokimo mokimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, this looks simple, clean & full fills the adobe home request. Love it 🚀

@spadmasa
Copy link

spadmasa commented Sep 2, 2024

@spadmasa spadmasa added the verified PR has been E2E tested by a reviewer label Sep 2, 2024
@milo-pr-merge
Copy link
Contributor

milo-pr-merge bot commented Sep 2, 2024

Skipped 2802: "Checking if Ims is already initialized before loading it" due to file "libs/blocks/global-navigation/global-navigation.js" overlap. Merging will be attempted in the next batch

@milo-pr-merge milo-pr-merge bot merged commit 318f2e8 into stage Sep 3, 2024
20 checks passed
@milo-pr-merge milo-pr-merge bot deleted the gnav branch September 3, 2024 18:08
@milo-pr-merge milo-pr-merge bot mentioned this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Stage verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants