Skip to content
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

fix: database query with subscribe never fetches #77

Open
wants to merge 2 commits into
base: dev-release
Choose a base branch
from

Conversation

mbergal
Copy link

@mbergal mbergal commented Nov 10, 2022

Fixes: #73

@CLAassistant
Copy link

CLAassistant commented Nov 10, 2022

CLA assistant check
All committers have signed the CLA.

@mbergal mbergal changed the base branch from main to dev-release November 10, 2022 18:47
eventCount[subscriptionHash] ??= 0;
eventCount[subscriptionHash]++;
if (eventCount[subscriptionHash] === 1) {
resolvePromise(data || null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolvePromise(data || null);
resolvePromise(data ?? null);

Otherwise, if data === false you get back null and you never get the actual value of the data. 🤦🏼‍♂️

I spent hours trying to figure out why my DB value of false kept coming back null.

@futurus
Copy link

futurus commented Jul 15, 2023

@mbergal Do you mind signing the CLA please? A lot of peeps are waiting on this fix it looks like 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Querying firestore documents with subscribe never fetches
4 participants