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

[sitecore-jss-react] Allow defer prop on VisitorIdentification component #1090

Merged

Conversation

pzi
Copy link
Contributor

@pzi pzi commented Jul 5, 2022

Add support for the defer prop to the VisitorIdentification component to support non-blocking script loading.

This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case.

Description / Motivation

Opt-in to make VisitorIdentification non-blocking.

Testing Details

Component does not have any tests.
Setting defer to true will render <script defer ...></script>.
Setting defer to false or undefined will render <script ...></script>.

Making the prop optional makes this a non-breaking change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@pzi pzi changed the title feat: allow defer prop on VisitorIdentification component [sitecore-jss-react] Allow defer prop on VisitorIdentification component Jul 5, 2022
@pzi
Copy link
Contributor Author

pzi commented Jul 22, 2022

@ambrauer @sc-addypathania some feedback on this would be appreciated :)

Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for the contribution!

FYI @Sitecore/jss-dev-reviewers I've added a corresponding task to our backlog to cover any additional testing scenarios I might be missing (e.g. probably time we add unit tests for the component 😊).

@ambrauer ambrauer merged commit 91d6f25 into Sitecore:dev Jul 25, 2022
@pzi
Copy link
Contributor Author

pzi commented Jul 26, 2022

Thanks @ambrauer 🙏🏼

@pzi pzi deleted the feature/defer-prop-for-visitoridentification branch July 26, 2022 01:06
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.

2 participants