reactfire icon indicating copy to clipboard operation
reactfire copied to clipboard

useUser throws even when auth sdk is not loaded despite having provided startWithValue

Open mateja176 opened this issue 5 years ago • 0 comments

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

mateja176 avatar Aug 23 '20 14:08 mateja176