-
Notifications
You must be signed in to change notification settings - Fork 401
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
Make sure Firestore hooks return undefined
when data does not exist
#446
Conversation
Turns out this is an issue with Reproduced with failing test "useObservable > Non-Suspense Mode > emits even if data is undefined" |
React.useEffect(() => { | ||
const subscription = observable.subscribe({ | ||
next: (v) => { | ||
setValue(() => v); |
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.
This is where the original issue was. Since value
was undefined when the state was set up, calling setValue(() => undefined)
meant that React didn't trigger a re-render, since value
didn't change.
I'm going to admin-merge this because #438 is a pretty active discussion so a fast fix would be beneficial, I was able to repro the original issue with a test that is now green, and |
fixes #440