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(analytics): removed providedIn: 'any' from the service injectable #2605

Merged
merged 1 commit into from Oct 30, 2020

Conversation

jackcw
Copy link
Contributor

@jackcw jackcw commented Oct 1, 2020

Checklist

  • Issue number for this PR: #2604
  • Docs included?: no
  • Test units included?: no
  • In a clean directory, yarn install, yarn test run successfully? yes

Description

The ScreenTrackingService and UserTrackingService would automatically be initialised even when not provided meaning you cant turn them off.

Code sample

Changed from

@Injectable({ providedIn: 'any' })

to

@Injectable()

Copy link
Contributor

@yasinkocak yasinkocak left a comment

Should this not be a singleton?

@Injectable({
  providedIn: 'root'
})

@jackcw
Copy link
Contributor Author

@jackcw jackcw commented Oct 5, 2020

When i tried that @yasinkocak it triggers the screen_view event when its not provided. Only way to make it work that i saw was with removing providedIn all together

@jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented Oct 9, 2020

Interesting, so the theses modules aren't tree-shaking out even if you don't provide them... weird. Let me dig into this a bit and see if we can address in a patch. Thanks for the help :)

Copy link
Member

@jamesdaniels jamesdaniels left a comment

This looks like a good solution to me.

@jamesdaniels jamesdaniels merged commit 92f7aaf into angular:master Oct 30, 2020
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants