Skip to content

Commit ff5b78e

Browse files
committed
fix the delete loop
1 parent 4617b3c commit ff5b78e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/component/src/provider.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,20 @@ export class Provider<T extends Name> {
174174
...services
175175
.filter(service => 'INTERNAL' in service) // legacy services
176176
// eslint-disable-next-line @typescript-eslint/no-explicit-any
177-
.map(service => (service as any).INTERNAL!.delete())
178-
// ...services
179-
// .filter(service => 'delete' in service) // next services
180-
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
181-
// .map(service => (service as any).delete())
177+
.map(service => (service as any).INTERNAL!.delete()),
178+
...services
179+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
180+
.filter(
181+
service =>
182+
'delete' in service &&
183+
this.component &&
184+
// TODO: remove !== 'app' when modular SDKs become official
185+
// People call app.delete() to trigger provider.delete() for all registered components, so
186+
// we don't call delete() on legacy FirebaseApp to avoid getting into a loop.
187+
(this.component.name as any) !== 'app'
188+
) // modular services
189+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
190+
.map(service => (service as any).delete())
182191
]);
183192
}
184193

0 commit comments

Comments
 (0)