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

Fixing perf and fcm #2597

Merged
merged 5 commits into from
Sep 25, 2020
Merged

Fixing perf and fcm #2597

merged 5 commits into from
Sep 25, 2020

Conversation

jamesdaniels
Copy link
Member

Checklist

  • Issue number for this PR: #nnn (required)
  • Docs included?: (yes/no; required for all API/functional changes)
  • Test units included?: (yes/no; required)
  • In a clean directory, yarn install, yarn test run successfully? (yes/no; required)

Description

Code sample

Copy link
Member

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

LGTM with a couple of nits.

These FCM changes look promising. I'll be interested to see if they solve the conflicts that have been reported with ngsw.

constructor(public readonly messaging: AngularFireMessaging, swPush: SwPush) {
messaging.usePublicVapidKey('BIDPctnXHQDIjcOXxDS6qQcz-QTws7bL8v7UPgFnS1Ky5BZL3jS3-XXfxwRHmAUMOk7pXme7ttOBvVoIfX57PEo').then(() => {
constructor(public readonly messaging: AngularFireMessaging, readonly swpush: SwPush) {
swpush.messages.subscribe(it => console.log('swpush', it));
Copy link
Member

Choose a reason for hiding this comment

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

Was this just for debugging?

Copy link
Member

Choose a reason for hiding this comment

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

Oh this is in the sample app, so this looks good then! Missed that on the first pass.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it seems FCM has made some changes to the FCM API that have affected us. Experimenting with different variations on Service Workers and FCM in the sample app & will probably revamp those guides shortly.

src/auth/auth.ts Outdated Show resolved Hide resolved
Comment on lines -35 to -36
switchMap(() => import('@firebase/performance')),
tap(perf => perf.registerPerformance && perf.registerPerformance(firebase as any)),
Copy link
Member

Choose a reason for hiding this comment

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

Glad to see these aren't needed. I did some testing to see if they were causing issues, but they weren't... though I'm not sure if they were doing anything useful either :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah these register calls aren't great... it's weird and they're private APIs, so the JS SDK team can change them at any point.

I've found that I've needed them for some SSR cases but it seems marking everything as an external in angular.json makes it so they aren't always needed. In either case, perf mon is only browser, so I can drop this. I believe the root problem is due to ngcc failing when it hits the CJS version of Firebase. It's somehow messing with the side-effects of the import. We've tried to address a couple times but keep running into issues. That said, we have a tree-shakable version of the JS SDK on the way https://github.com/firebase/firebase-js-sdk/blob/master/docs-exp/index.md that should play much much better with Angular; so I don't think it's worth spending much time trying to solving the CJS / tree-shake problems with NG10 & the namespaced JS SDK.

Copy link
Member

Choose a reason for hiding this comment

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

Great news on the tree-shakable JS SDK 👍 Sounds like there will be plenty of refactoring later this year or next year 😁

@jamesdaniels jamesdaniels merged commit 1608676 into master Sep 25, 2020
@jamesdaniels jamesdaniels deleted the fixing_perf_and_working_on_sample branch September 25, 2020 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants