Skip to content

Commit d3304aa

Browse files
committed
fix(angular): Add dependency array + recaptcha SSR check
1 parent 052c495 commit d3304aa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/angular/src/lib/provider.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ import {
2525
effect,
2626
Signal,
2727
ElementRef,
28+
Optional,
29+
PLATFORM_ID,
2830
} from "@angular/core";
31+
import { isPlatformBrowser } from "@angular/common";
2932
import { FirebaseApps } from "@angular/fire/app";
33+
import { Auth } from "@angular/fire/auth";
3034
import {
3135
createEmailLinkAuthFormSchema,
3236
createForgotPasswordAuthFormSchema,
@@ -60,6 +64,7 @@ export function provideFirebaseUI(uiFactory: (apps: FirebaseApps) => FirebaseUIS
6064
// see https://github.com/angular/angularfire/blob/35e0a9859299010488852b1826e4083abe56528f/src/firestore/firestore.module.ts#L76
6165
{
6266
provide: FIREBASE_UI_STORE,
67+
deps: [FirebaseApps, [new Optional(), Auth]],
6368
useFactory: () => {
6469
const apps = inject(FirebaseApps);
6570
if (!apps || apps.length === 0) {
@@ -92,7 +97,12 @@ export function injectUI() {
9297

9398
export function injectRecaptchaVerifier(element: () => ElementRef<HTMLDivElement>) {
9499
const ui = injectUI();
100+
const platformId = inject(PLATFORM_ID);
101+
95102
const verifier = computed(() => {
103+
if (!isPlatformBrowser(platformId)) {
104+
return null;
105+
}
96106
const elementRef = element();
97107
if (!elementRef) {
98108
return null;

0 commit comments

Comments
 (0)