Skip to content

Commit

Permalink
fix the delete loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Feiyang1 committed Aug 12, 2020
1 parent 4617b3c commit ff5b78e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/component/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,20 @@ export class Provider<T extends Name> {
...services
.filter(service => 'INTERNAL' in service) // legacy services
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.map(service => (service as any).INTERNAL!.delete())
// ...services
// .filter(service => 'delete' in service) // next services
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
// .map(service => (service as any).delete())
.map(service => (service as any).INTERNAL!.delete()),
...services
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.filter(
service =>
'delete' in service &&
this.component &&
// TODO: remove !== 'app' when modular SDKs become official
// People call app.delete() to trigger provider.delete() for all registered components, so
// we don't call delete() on legacy FirebaseApp to avoid getting into a loop.
(this.component.name as any) !== 'app'
) // modular services
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.map(service => (service as any).delete())
]);
}

Expand Down

0 comments on commit ff5b78e

Please sign in to comment.