Discussion: the road to AngularFire v6
The road to AngularFire v6
Angular 9 is coming soon! Let's kick off discussions on what AngularFire v6 will look like. We've managed to keep the API stable and introduce no (intentional) breaks for over a year! 🎉
Hope everyone has enjoyed this consistency.
Why break at all?
We currently support three Angular (6, 7, and 8) and Firebase majors (5, 6, and 7) with the current version of AngularFire... that's a lot of work.
To support older versions of Firebase we have a number of conditionals and a lot of unneeded code/types.
To maintain support for older versions of Angular, we've been holding back our typescript version and not adopting any new APIs.
Plan of action
Version 5.3:
Release it, WIP here #2187
Version 5.4:
Reimplement @angular/fire/database-deprecated using @angular/fire/database under the hood. It's been raised that database-deprecated has been pretty broken since we've dropped it from our test suite but it is holding back some of our developers from upgrading. We should try to get them on the latest version of 5, before we start breaking things.
Perhaps at this point we'll mark peer support for Angular 9.0 final. So far in my testing the release candidates seem to work fine and we shouldn't need to break a major to support.
Once we've dealt with that:
Version 5.3.1:
Cherry-pick the fixes for the ng add and ng deploy commands.
Version 6:
- Bump the peer dependency to the latest minor of Firebase (currently v7.6)
- Bump the peer dependency of Angular to v9
- Bump the peer dependency of Typescript to bring inline with Angular v9 (currently v3.6)
- Various bugs / types / export naming (see
SEMVERcomments in the source) - Change our build process to use
ng-packagr#2117 - Drop the
angularfire2shim releases on NPM - Add the SDK proxy that
AngularFireAnalyticsandAngularFireRemoteConfiguse in the upcoming 5.3 release (#2187) to all the modules and drop the instance getters. - ~Make all modules side-effect free (no longer importing the SDKs)~
Version 6.1:
- "Lazy" versions of all the "non-lazy" modules. These do not assume the developer has loaded any of the Firebase SDKs and will dynamically import them; obviously some APIs will be different.
Version 7:
- Drop the "non-lazy" modules
- Move all our operators, observables, etc. to pure-functions (more on this soon)
- whatever else we think of by then...
Things we're thinking of:
- Reduce the amount of code in this library by leaning on RxFire
Can we build a migrator forDuring my investigation I found little evidence that those still using@angular/fire/database-deprecatedin a reasonable timespan? If so, I'll dropdatabase-depreciatedin version 6, if not we'll punt until version 7.database-depreciatedhad moved to 5.0 stable; I've decided to drop for 6.0.- How different would the "lazy" modules actually be? Can we just migrate over to them in 6 rather than have them be optional until 7?
- ~Require the user
import 'firebase/*'themselves before use of the non-lazy modules, this would allow us to export all the packages under@angular/fireand mark them as having no side-effects.~ ngcc no longer has issue with this - Shallow up the exports, if we're entirely side-effect free we can export everything in
@angular/firerather than having sub-packages. - Strong type support in the vanilla Firestore SDK is available now with FirestoreDataConverter. Can we leverage this to get some of our Firestore type work for free in AngularFire & make the guarantees "stronger"? Can we use this for production-worthy state-transfer?
@puchesjr Thanks! I started with the first solution before, but I did not really like it.
The second solution is perfect for my case, I found this on stackoverflow too, and it's this solution I'm trying to implement.
It would be nice if we could select angularfire in the code examples too:

HI everyone!
Just a quick queston here: do we get closer to the v6 for AngularFire ? It'd be so great to be able to upgrade to Angular 9 with all the benefits of Ivy :)!
Hey there!
Seriously, where are we with the v6 ? It's been more than 1 month since the last commit in the master. @jamesdaniels , is everything ok ? I really hope so and that nothing related to Covid-19 is affecting you or others. Are there any big issue to continuing the road to v6 ?
I also hope everything is going well @jamesdaniels and hoping for new updates soon. Let us know if there is anything the community can do to help with AngularFire v6.
@jamesdaniels I would like you to authorized me to have right to close issues, there's so many unresolved problem. I can help to clean it.
Hey all, sorry for the radio silence. My family and I are doing well, there's been some minor symptoms that had us worried, but we all seem to be in good health now. Thanks for your concern! :D Hope all our community members are safe and healthy.
Honestly adjusting to WFH, preparing for ng-conf, and the changes w/re to Google I/O and Cloud Next have ate up a lot of my time lately. Jumping back into Github now & will cut what I hope to be the last RC shortly. Aiming for 6.0 stable next week.
@hiepxanh I'll discuss with other stakeholders at some point, see if that's something we're open to.
We are aiming to be more diligent with errors, documentation, and Stackoverflow once 6.0 is out the door.
@jamesdaniels I'm glad you're fine. That's so good to know that. Just feeling happy you are safe out there. Be healthy, and let us know anything we can help. BTW, I just want to help you resolve some issues. Since David East seem to be busy. Hope that everything is fine.
@jamesdaniels , so glad that you're ok and your family too! Working from home is indeed a bit challenging, with this situation from one part, and also when you have kids to deal ^^.
About the lib: great news and excellent planning for the community
Hey @jamesdaniels, I see that you've just landed v6.0 of AngularFire (0be51e606a02a701f47f8242b7ae1744c9e4a521). However, could you detail how to update our apps to use AngularFire v6.0? I see that there are many breaking changes, but no description detailing exactly how to migrate our apps.
For e.g., the changelog mentions that:
AngularFireAuthhas dropped theauthproperty and instead Promise Proxies the underlying Firebaseauth.Authinstance; allowing your development experience to more closely mirror the JS SDK. Similar changes have been made toAngularFireFunctions,AngularFireMessaging, andAngularFirePerformance.
However, there's no detailed description of how exactly to migrate functionality related to the service.
(And there aren't any typings for the underlying firebase.auth.Auth class? For e.g. I'd tried accessing the current user via the firebase.auth.Auth.currentUser property, but found out that there was no such property in the typings as per the error below)
Property 'currentUser' does not exist on type 'AngularFireAuth'.
EDIT:
Turns out that the issues were caused by me updating AngularFire while Angular CLI was still serving my app. I solved the issue by terminating the serve process then reissuing the command.
EDIT No. 2:
It seems that the properties in the Firebase JS SDK now return Promise versions of their counterparts.
For e.g. AngularFireAuth.auth.currentUser used to return User | null. However, AngularFireAuth.currentUser now returns Promise<User | null>. Is this intentional?
@EdricChan03 sorry about that changelog entry being dense & not well explained. I'll make sure to document that better.
Re your edit no. 2, yes that's intentional. Our plan is to lazy-load the Firebase JS SDK while we are waiting for them to become more modular / tree-shakable; hence our "promise proxy". No timeframes but hoping that our work there will begin bearing fruit soon. I will absolutely do a doc push but just had to get this release out the door, don't mind any rough corners & feel free to send any PRs if you have an idea on how to better communicate this!
currentUser returns null.
https://github.com/angular/angularfire/issues/2378
Hello, I just experience some buggy or not clearly on the "How Angular Fire work". Specificly:
- There is some cache problem if you using
take(1)with angularfire. It's just not refresh the data. https://github.com/angular/angularfire/issues/2336 https://github.com/angular/angularfire/issues/2012 - I just create an issue here explain which have video which explain the problem https://github.com/angular/angularfire/issues/2387
And then trying to debug and I find out that It return data twice instead of one. If I undestand correctly, so we should take the second If we dont want to get realtime update. For example: if you get the data using
take(1)it only return cache value (addeddata). If you want to get fresh and not want to subscribe on everytime data update. usetake(2)to getmodifeddata.
Don't you mind if you looking into this, sir? @jamesdaniels can you confirm my idea above and help me to explain the idea behind? that could help us update the docs on this angularfire 6 version. And close 3 issues above
Feature request:
i have multiple angular projects (admin/frontend/mobile) and they have separate firebase hosting.
added deploy section on all projects in angular.json but ng deploy do just 1 project. And pick up the first hosting target on firebase.rc does not match.
other requested feature is.
i have 2 firebase instance (development/production). Normally u can switch with firebase use production this does not support.
Feature request : fix all bugs and make an usable tool
This project only maintain by @jamesdaniels I consider to help him to clear issues and address problem but he doesn't need
I hope we can add this PR to coming release: https://github.com/angular/angularfire/pull/2497
Just cut a preview of 6.0.1 to @canary which should address some issues. Will push out a proper release and write release notes after I do some smoke tests in the AM.
With the recent release of 6.1 I'm really feeling happy with the 6 series and that despite some rocks in the road (that we've overcome together) it's living up to what I hoped. I'm going to close this issue.
That's not to say 6-series is done. Things I'd like to get done in minors in the coming weeks/months:
- add auto-configuration abilities to those using Hosting
- lazy versions of Storage, Database, and Firestore
- clean up our snapshot action types
- easier APIs for firestore metadata and filtering
- make FCM+NGSW work-arounds official
- server-side Auth
- more schematic work
- accepting contributions from community members like you 🌈 😄
Other than those issues, really just continuing to tighten the API, I don't foresee doing any other major API work until 7.0 (or whatever the next tick release is for us).
On the horizon we have JS SDK vNext which is a modular rewrite of the Firebase JS SDK. I'm still thinking about what this will mean for AngularFire and will start a vNext roadmap once I have enough thoughts together to take community feedback.