From 0f7d43980f5692770681784f5fd591748fc3622c Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 14:19:11 -0500 Subject: [PATCH 1/6] docs(): Update link to Fireship SSR videos closes #2463 --- docs/universal/cloud-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/universal/cloud-functions.md b/docs/universal/cloud-functions.md index 126853e9a..ff344acc6 100644 --- a/docs/universal/cloud-functions.md +++ b/docs/universal/cloud-functions.md @@ -72,4 +72,4 @@ To test, spin up the emulator with `firebase serve`. Once you've confirmed it's ## Additional Resources - [Universal Starter Template](https://github.com/angular/universal-starter) -- [AngularFirebase SSR Videos](https://angularfirebase.com/tag/ssr/) +- [FireShip: Angular Universal SSR with Firebase](https://fireship.io/lessons/angular-universal-firebase/) From 2ce41aa0af8c5f42df65f5ac5b2b5a50fb6f4300 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 14:29:41 -0500 Subject: [PATCH 2/6] fix(storage): error state not represent in UploadTaskSnapshot (#2665) --- src/storage/observable/fromTask.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/storage/observable/fromTask.ts b/src/storage/observable/fromTask.ts index 8b485eae1..ae4d8ec94 100644 --- a/src/storage/observable/fromTask.ts +++ b/src/storage/observable/fromTask.ts @@ -6,7 +6,10 @@ export function fromTask(task: UploadTask) { const progress = (snap: UploadTaskSnapshot) => subscriber.next(snap); const error = e => subscriber.error(e); const complete = () => subscriber.complete(); - task.on('state_changed', progress, error, () => { + task.on('state_changed', progress, (e) => { + progress(task.snapshot); + error(e); + }, () => { progress(task.snapshot); complete(); }); From 7f896439a4d1c155ae957a1bb2374cac2d524577 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 18:56:43 -0500 Subject: [PATCH 3/6] fix(core): fix the instance cache logic (#2667) --- sample/src/app/app.module.ts | 3 ++- src/core/firebase.app.module.ts | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sample/src/app/app.module.ts b/sample/src/app/app.module.ts index 4610f5b2a..7dceb39d5 100644 --- a/sample/src/app/app.module.ts +++ b/sample/src/app/app.module.ts @@ -20,7 +20,7 @@ import { import { FirestoreComponent } from './firestore/firestore.component'; import { AngularFireDatabaseModule, USE_EMULATOR as USE_DATABASE_EMULATOR } from '@angular/fire/database'; -import { AngularFirestoreModule, USE_EMULATOR as USE_FIRESTORE_EMULATOR } from '@angular/fire/firestore'; +import { AngularFirestoreModule, USE_EMULATOR as USE_FIRESTORE_EMULATOR, SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/firestore'; import { AngularFireStorageModule } from '@angular/fire/storage'; import { AngularFireAuthModule, USE_DEVICE_LANGUAGE, USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/auth'; import { AngularFireMessagingModule, SERVICE_WORKER, VAPID_KEY } from '@angular/fire/messaging'; @@ -73,6 +73,7 @@ import { FirestoreOfflineModule } from './firestore-offline/firestore-offline.mo UserTrackingService, ScreenTrackingService, PerformanceMonitoringService, + { provide: FIRESTORE_SETTINGS, useValue: { ignoreUndefinedProperties: true } }, { provide: ANALYTICS_DEBUG_MODE, useValue: true }, { provide: COLLECTION_ENABLED, useValue: true }, { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9099] : undefined }, diff --git a/src/core/firebase.app.module.ts b/src/core/firebase.app.module.ts index e1942e7e0..a28b52057 100644 --- a/src/core/firebase.app.module.ts +++ b/src/core/firebase.app.module.ts @@ -45,7 +45,7 @@ export function ɵfirebaseAppFactory(options: FirebaseOptions, zone: NgZone, nam const app = (existingApp || zone.runOutsideAngular(() => firebase.initializeApp(options, config as any))) as FirebaseApp; if (JSON.stringify(options) !== JSON.stringify(app.options)) { const hmr = !!(module as any).hot; - log('error', `${app.toString()} already initialized with different options${hmr ? ', you may need to reload as Firebase is not HMR aware.' : '.'}`); + log('error', `${app.name} Firebase App already initialized with different options${hmr ? ', you may need to reload as Firebase is not HMR aware.' : '.'}`); } return app; } @@ -65,16 +65,18 @@ globalThis.ɵAngularfireInstanceCache ||= new Map(); export function ɵfetchInstance(cacheKey: any, moduleName: string, app: FirebaseApp, fn: () => T, args: any[]): T { const [instance, ...cachedArgs] = globalThis.ɵAngularfireInstanceCache.get(cacheKey) || []; - if (instance && args.some((arg, i) => { - const cachedArg = cachedArgs[i]; - if (arg && typeof arg === 'object') { - return JSON.stringify(arg) !== JSON.stringify(cachedArg); - } else { - return arg !== cachedArg; + if (instance) { + if (args.some((arg, i) => { + const cachedArg = cachedArgs[i]; + if (arg && typeof arg === 'object') { + return JSON.stringify(arg) !== JSON.stringify(cachedArg); + } else { + return arg !== cachedArg; + } + })) { + const hmr = !!(module as any).hot; + log('error', `${moduleName} was already initialized on the ${app.name} Firebase App instance with different settings.${hmr ? ' You may need to reload as Firebase is not HMR aware.' : ''}`); } - })) { - const hmr = !!(module as any).hot; - log('error', `${moduleName} was already initialized on the ${app.name} Firebase App instance with different settings.${hmr ? ' You may need to reload as Firebase is not HMR aware.' : ''}`); return instance; } else { const newInstance = fn(); From 22e28839c5bff6a090cf1588c2212aaa305e546e Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 19:12:26 -0500 Subject: [PATCH 4/6] fix(afs): fix regression keeping one from overriding collection.doc type (#2668) --- src/firestore/collection/collection.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/firestore/collection/collection.ts b/src/firestore/collection/collection.ts index d76cb35f3..9e77f27a0 100644 --- a/src/firestore/collection/collection.ts +++ b/src/firestore/collection/collection.ts @@ -141,7 +141,8 @@ export class AngularFirestoreCollection { /** * Create a reference to a single document in a collection. */ - doc(path?: string): AngularFirestoreDocument { - return new AngularFirestoreDocument(this.ref.doc(path), this.afs); + doc(path?: string): AngularFirestoreDocument { + // TODO is there a better way to solve this type issue + return new AngularFirestoreDocument(this.ref.doc(path) as any, this.afs); } } From dca4946a0c590946fff7954e0c8e9ac038e7f0cd Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 19:16:51 -0500 Subject: [PATCH 5/6] chore(): 6.1.1 changelog and package.json --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ea34894b..c1bbb2052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## [6.1.1](https://github.com/angular/angularfire/compare/6.1.0...6.1.1) (2020-11-19) + +### Bug Fixes + +* **afs:** fix regression keeping one from overriding collection.doc type ([#2668](https://github.com/angular/angularfire/issues/2668)) ([22e2883](https://github.com/angular/angularfire/commit/22e2883)) +* **core:** fix the instance cache logic ([#2667](https://github.com/angular/angularfire/issues/2667)) ([7f89643](https://github.com/* **storage:** error state not represent in UploadTaskSnapshot ([#2665](https://github.com/angular/angularfire/issues/2665)) ([2ce41aa](https://github.com/angular/angularfire/commit/2ce41aa)) + + # [6.1.0](https://github.com/angular/angularfire/compare/6.0.4...6.1.0) (2020-11-18) diff --git a/package.json b/package.json index caa46fe8b..716b307a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@angular/fire", - "version": "6.1.0", + "version": "6.1.1", "description": "The official Angular library for Firebase.", "private": true, "scripts": { From 2dddefd55000f2d561c4aad63c8257f1dfe4386f Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 18 Nov 2020 19:20:57 -0500 Subject: [PATCH 6/6] chore(): fix changelog entry --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1bbb2052..daa81f18d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ -## [6.1.1](https://github.com/angular/angularfire/compare/6.1.0...6.1.1) (2020-11-19) +# [6.1.1](https://github.com/angular/angularfire/compare/6.1.0...6.1.1) (2020-11-19) ### Bug Fixes * **afs:** fix regression keeping one from overriding collection.doc type ([#2668](https://github.com/angular/angularfire/issues/2668)) ([22e2883](https://github.com/angular/angularfire/commit/22e2883)) -* **core:** fix the instance cache logic ([#2667](https://github.com/angular/angularfire/issues/2667)) ([7f89643](https://github.com/* **storage:** error state not represent in UploadTaskSnapshot ([#2665](https://github.com/angular/angularfire/issues/2665)) ([2ce41aa](https://github.com/angular/angularfire/commit/2ce41aa)) +* **core:** fix the instance cache logic ([#2667](https://github.com/angular/angularfire/issues/2667)) ([7f89643](https://github.com/angular/angularfire/commit/7f89643)) +* **storage:** error state not represent in UploadTaskSnapshot ([#2665](https://github.com/angular/angularfire/issues/2665)) ([2ce41aa](https://github.com/angular/angularfire/commit/2ce41aa))