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

Add CustomEvent polyfill from Mozilla docs #17095

Merged
merged 5 commits into from
May 6, 2021
Merged

Conversation

bkjohnson
Copy link
Contributor

@bkjohnson bkjohnson commented May 5, 2021

Description

This PR adds a polyfill for CustomEvent since it isn't supported natively in IE11. This API is necessary for the analytics coming from component-library components.

The polyfill was copy-pasted with light modifications from https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill
We are using core-js for several other polyfills, but that package has chosen not to support CustomEvent.

Relevant slack thread.

Testing done

  1. @U-DON narrowed the problem in vets-website down to a dependency upgrade for component-library from 2.3.1 to 2.4.0. changes
  2. Confirmed that the problem was with the dispatchAnalyticsEvent call by commenting it out and putting a simple console.log('hi') in the lifecycle method - the hca app loaded without the Object does not support this action error and we saw the expected log message.
  3. Uncomment the event code and rebuild the dependency.
  4. Add the polyfill in vets-website
  5. Try to load an app and verify that it loads as expected
  6. Put another console.log in the analytics event handler to verify that the CustomEvent is being fired.

Screenshots

Acceptance criteria

  • [ ]

Definition of done

  • Events are logged appropriately
  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs

@bkjohnson bkjohnson requested review from U-DON, bsmartin-ep and a team May 5, 2021 22:27
@va-vfs-bot va-vfs-bot requested a review from a team May 5, 2021 22:33
Copy link

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

src/platform/polyfills/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@bsmartin-ep bsmartin-ep left a comment

Choose a reason for hiding this comment

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

LGTM

@va-vfs-bot va-vfs-bot temporarily deployed to master/customevents-polyfill/master May 6, 2021 16:20 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/customevents-polyfill/master May 6, 2021 16:55 Inactive
@bkjohnson bkjohnson merged commit daacc2c into master May 6, 2021
@bkjohnson bkjohnson deleted the customevents-polyfill branch May 6, 2021 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants