Skip to content

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

@TomKaltz

Description

@TomKaltz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions