reactfire
reactfire copied to clipboard
useUser throws even when auth sdk is not loaded despite having provided startWithValue
Version info
React: latest
Firebase: latest
ReactFire: latest
Other (e.g. Node, browser, operating system) (if applicable):
Test case
Steps to reproduce
Instantiate useUser in a component.
import React from 'react'
import { render } from 'react-dom'
const App: React.FC = () => {
const user = useUser(undefined, { startWithValue: 'loading' })
return <div>{!user ? 'Signed out' : user === 'loading' ? 'Loading...' : `Hello ${user.displayName}`}</div>
}
render(<App />, document.getElementById('root')) // throws
Expected behavior
Taken from the API docs:
Options. This hook will not throw a Promise if you provide startWithValue.
Actual behavior
Component is supended