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

Create an onReady and onError callback for standalone gnav #2873

Merged
merged 18 commits into from
Sep 25, 2024

Conversation

bandana147
Copy link
Contributor

  • Adds an onReady callback that will be triggered when Gnav loads
  • Adds an onError callback that will be triggered if any error occurs inside gnav

Resolves: MWPW-158168

Test URLs:

Qa: https://adobecom.github.io/nav-consumer/navigation.html?authoringpath=/federal/dev&env=stage&navbranch=gnav-event

Copy link
Contributor

aem-code-sync bot commented Sep 12, 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 Sep 12, 2024

Page Scores Audits Google
📱 /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.29%. Comparing base (5ddeb73) to head (40b7b0c).
Report is 4 commits behind head on stage.

Additional details and impacted files
@@           Coverage Diff           @@
##            stage    #2873   +/-   ##
=======================================
  Coverage   96.29%   96.29%           
=======================================
  Files         240      240           
  Lines       54739    54750   +11     
=======================================
+ Hits        52709    52724   +15     
+ Misses       2030     2026    -4     

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

@@ -317,7 +317,9 @@ class Gnav {
await yieldToMain();
await task();
}

// Dispatching an event when gnav loads and is visible
window.dispatchEvent(new CustomEvent('feds:nav.ready'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
window.dispatchEvent(new CustomEvent('feds:nav.ready'));
window.dispatchEvent(new CustomEvent('feds:nav:ready'));

Copy link
Contributor

@mokimo mokimo Sep 12, 2024

Choose a reason for hiding this comment

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

On another note, since it's a milo block, should we dispatch milo:globalnav:ready ? That follows the other eventlisteners such as milo:modal:closed within the ecosystem

@mokimo
Copy link
Contributor

mokimo commented Sep 12, 2024

As a more general question, why is that needed and what is the use-case? The ticket and description don't mention anything

@bandana147
Copy link
Contributor Author

bandana147 commented Sep 12, 2024

As a more general question, why is that needed and what is the use-case? The ticket and description don't mention anything

@mokimo This is currently required for the Adobe Home team, but we thought it would be a good use case to support as a standalone component. They want to display a loader state until the Gnav fully loads and be able to handle/track any errors that occur within their app.

@bandana147 bandana147 requested a review from a team as a code owner September 13, 2024 08:37
Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@bandana147
Copy link
Contributor Author

@narcis-radu @mokimo Could you please review the updated changes?

Copy link
Contributor

Reminder to set the Ready for Stage label - to queue this to get merged to stage & production.

@milo-pr-merge
Copy link
Contributor

milo-pr-merge bot commented Sep 24, 2024

Skipped 2873: "Create an onReady and onError callback for standalone gnav" 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 94fcec9 into stage Sep 25, 2024
14 checks passed
@milo-pr-merge milo-pr-merge bot deleted the gnav-event branch September 25, 2024 08:32
@milo-pr-merge milo-pr-merge bot mentioned this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical 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.

9 participants