The idea was that we might be able to get useUser to load with the correct auth state faster than if we had waited for the underlying useIdTokenResult to finish. This was based on the assumption that auth.currentUser is undefined while the Auth SDK is booting up, nullonly when the Auth SDK is booted up and a user isn't signed in, and truthy otherwise.
Description
useUser
currently overridesinitialData
ifauth.currentUser
is not undefined:https://github.com/FirebaseExtended/reactfire/blob/414201e88bd6f6701998993f6203e4d49773147b/src/auth.tsx#L29-L33
The idea was that we might be able to get
useUser
to load with the correct auth state faster than if we had waited for the underlyinguseIdTokenResult
to finish. This was based on the assumption thatauth.currentUser
isundefined
while the Auth SDK is booting up,null
only when the Auth SDK is booted up and a user isn't signed in, and truthy otherwise.However, this is undocumented behavior, so we shouldn't rely on it.