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

useDatabaseListData only fetch data once #531

Open
muhammadnasr opened this issue Jul 28, 2022 · 5 comments
Open

useDatabaseListData only fetch data once #531

muhammadnasr opened this issue Jul 28, 2022 · 5 comments

Comments

@muhammadnasr
Copy link

useDatabaseListData only fetches data once and does not listen to updates
I am using react 18 and firebase 9

after hours of debugging and when I switch to useDatabaseObjectData, data is updated properly.

@sojumoscow
Copy link

sojumoscow commented Sep 19, 2022

Did you fix this useDatabaseListData ? I'm also getting this bug. I need to reload my browser in order to fetch the right data. Even the status is success, it doesn't show any data unless I reload the browser. Should have mentioned it in the docs.

@CerceJo
Copy link

CerceJo commented Feb 16, 2023

When running in Jest/react-testing-framework, useDatabaseListData stops updating after a simple call to remove between tests clears the part of the database at the point where useDatabaseListData is referenced.

@dtinth
Copy link

dtinth commented Jul 24, 2023

I was hit by this bug too. I ended up re-implementing useDatabaseListData on top of Nano Stores, which resolved the issue for me. The code is here: https://github.com/wonderfulsoftware/ansr/blob/main/web/src/nanofire.ts (Not a complete implementation — it only supports a subset of the API that I actually use.)

@OsamaMSoliman
Copy link

it's exactly the same situation like stated here #497

using useDatabaseObjectData for now is a nice catch, thanks @muhammadnasr

@mattrossman
Copy link

Unfortunately the useDatabaseObjectData workaround doesn't seem to support filtering with query() as shown here:
https://github.com/FirebaseExtended/reactfire/blob/9429194d9dfed9a4b37129661d230ebcd0071e89/docs/use.md#show-a-list-of-data

For example, when I subscribe to query(myRef, limitToFirst(1)) with useDatabaseObjectData I receive all children instead of just the first. I'm not too surprised because that hook doesn't allow Query types for the ref argument.

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

No branches or pull requests

6 participants