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

fix(strictmode): Fix for React in StrictMode causing a duplicate script registration #87

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jafin
Copy link
Contributor

@jafin jafin commented Sep 9, 2024

fix (StrictMode): Fix issue where google script will be injected twice in StrictMode due to InitGTM being fired twice and the script operation just appending to the dom

  • Update scripts to React 18
  • InitGTM will now delete existing script and readd if found to avoid duplicate scripts.
  • Demo updated to use StrictMode

In theory InitGTM could just be a noop if the script already exists, but I am unsure if there is scope for a script to be reregistered for some reason, hence the delete/add approach.

…rictMode due to InitGTM being fired twice.

- Update scripts to React 18
- InitGTM will now delete existing script and readd if found to avoid duplicate scripts.
- Demo updated to use StrictMode
@jafin jafin changed the base branch from master to develop September 12, 2024 01:20
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.

1 participant