-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
runOutsideAngular for Universal compatibility and allow advanced configuration with DI #1454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! My only objection is the removing of the AngularFireModule
. It feels a little rough to make users do their own providers and we move away from mirroring the Firebase API.
I also think we need to go carefully through the runOutsideAngular
calls. There are sprinkled here and there throughout the code and it would be nice to find a cleaner way of including them. But I don't have a great yet.
src/core/firebase.app.module.ts
Outdated
import { FirebaseFirestore } from '@firebase/firestore-types'; | ||
|
||
export const FirebaseAppConfigToken = new InjectionToken<FirebaseAppConfig>('FirebaseAppConfigToken'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of removing theAngularFireModule
in place of making people do their own providers. I also like having the FirebaseApp
as an injectable.
AngularFireAuthModule, | ||
AngularFireDatabaseModule, | ||
AngularFirestoreModule | ||
], | ||
providers: [], | ||
providers: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this in action, I feel like it increases the "getting started" complexity. We should continue to mirror the Firebase API rather.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was thinking this too. I'll bring AngularFireModule
back in and allow users to use both whichever fits their use case best. Say in a specific module they need to call out to another app/database/whatnot.
Do you intend to bring in a mechanism for Auth between server and client? I currently use cookies in a working project. I didn't see code related to cookies in this branch. |
@patrickmichalina I've been considering this. I don't think I'll tackle in this PR however; just want to get the basics working first + see how adoption goes. |
@davideast yeah I tried to pull all the zone wrapping into a FirebaseZoneScheduler static function but was getting some binding issues all the way down in the minified grpc stuff. Only on the server too, so probably webpack doing something weird. I'll think on a cleaner pattern here BUT it works ;) |
Added WS and xmlhttprequest as dependencies, as they are required to allow normal functions of the Firebase JS SDK in Universal. Created a new `angularfire/firebase-node` module, which includes these + will include any additional fixes for Universal in the future. The rest of the SSR work is taking place in #1454.
thanks for your work, I'm looking to this, what was both of you did so amazing!!! 💯 |
src/core/firebase.app.module.ts
Outdated
|
||
export const FirebaseAppConfigToken = new InjectionToken<FirebaseAppConfig>('FirebaseAppConfigToken'); | ||
|
||
export class FirebaseApp implements FBApp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still like for us to provide the FirebaseApp
token for DI. It does conflict with the SDK but this would be a breaking change to remove it.
hello sir, is that any experiment api that I can test? I love to do something to help you :) |
@davideast working example up FYI https://onsnapshot-flex.appspot.com/
|
Added WS and xmlhttprequest as dependencies, as they are required to allow normal functions of the Firebase JS SDK in Universal. Created a new `angularfire/firebase-node` module, which includes these + will include any additional fixes for Universal in the future. The rest of the SSR work is taking place in angular#1454.
…iguration with DI (angular#1454) * First. * SSR work * StorageBucket is a string... * Add AngularFireModule back in * Fix up storage and the tests * Adding StorageBucket and DatabaseURL DI tests * Adding specs for DI in auth + firestore * More complete tests + fixed the storage test config * Adding app.module back in and writing tests for app injection * Export RealtimeDatabaseURL from database-deprecated * Export FirebaseApp * Working, needs wrapper * More * State changes and auditlog * Wrap auth * Reverted database-depricated a bit * More cleanup * Cleanup unused imports
Checklist
yarn install
,yarn test
run successfully? yesDescription
Doing some bulldozing in preparation for 5.0 final.
FirebaseAppConfig
andFirebaseAppName
Injection TokensStorageBucket
Injection TokenRealtimeDatabaseURL
Injection TokenCode sample
Coming soon...