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

useRead: prevent firebase-admin from being loaded in next.js client components #16

Open
TomKaltz opened this issue Feb 17, 2024 · 0 comments

Comments

@TomKaltz
Copy link

I ran into an issue with a next.js client component using useRead. When the component is pre-rendered on the server it would try to load firebase-admin and will throw an error since admin SDK was not configured. This is a client component so the query should only invoke the firebase browser sdk and perform the query in the client only. The workaround I added was to prevent the query from happening on the server using the following code...

useRead(typeof window !== 'undefined' && db.someModel.all().on);

Is there a way this feature can be built into this package so that I do not have to add this to every client component useRead query?

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

1 participant