-
Notifications
You must be signed in to change notification settings - Fork 940
Make initializeAuth() idempotent #5279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Changeset File Check
|
Size Analysis ReportAffected Products
|
3bc3f3b
to
d758208
Compare
d758208
to
c6c254e
Compare
@@ -54,7 +55,12 @@ export function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth { | |||
|
|||
if (provider.isInitialized()) { | |||
const auth = provider.getImmediate() as AuthImpl; | |||
_fail(auth, AuthErrorCode.ALREADY_INITIALIZED); | |||
const initialOptions = provider.getOptions() as Dependencies; | |||
if (deepEqual(initialOptions, deps ?? {})) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we are going to use reference equality for comparing builtin objects like popupRedirectResolver
s and persistence
s. Using deepEqual feels unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mainly using deepEqual to avoid extra lines of code, but also, while 2 of the 3 options (popupRedirectResolver
and errorMap
) can be compared using a simple ===
, persistence
can be an array, and on top of that, an array where order matters.
Making all product initialize() functions idempotent.
See #5272