-
Notifications
You must be signed in to change notification settings - Fork 68
Firestore re-arch w/ hooks+suspense #345
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
Conversation
* New FirebaseEmulatedAppProvider that wraps the reactfire/FirebaseAppProvider * POC FirestoreApiProvider for talking to the Emulator APIs * Add react-use cause it's so good for a bunch of utility functionality
Replace with a combination of reactfire/redux-hooks.
Remove old firebase-hooks
Similar strategy to reactfire's test suite
ReferenceError: globalThis is not defined
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.
First pass on the foundational files and setup. Will get to Firestore operations on the next pass and yet another line by line pass.
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.
The ReactFire bits look good. My only concern is about the upcoming API change (FirebaseExtended/reactfire#255).
const collectionSnapshot = useFirestoreCollection<unknown>(
filteredCollection
);
// turns into
const { data } = useFirestoreCollection<unknown>(
filteredCollection
);
You can merge now but just know that the update will come soon.
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.
Updated tests LGTM. Great work cleaning those mocks up!
The scope is a little on the XL-size but it made sense to bundle a few of the action-items together.
At a high-level, this is a re-architecture of the Firestore feature to rely on hooks+suspense. The biggest benefit here is that since we have nested-routing (where a document conditionally renders a sub-collection, and a collection conditionally renders a sub-document), we can now render as many documents/collections as are in the ROUTE and then lazily populate data in each component as it comes in over the wire; this gets us "missing document" support.
Missing document fix
Render
<Collection />
-- Conditionally render a sub
<Document />
if the route accounts for it-- The collection does not exist, show some copy: "Collection does not exist blah blah"
-- The
<Document />
can still renderAdditional updates
New dependencies
swr
reactfire
firebase-emulators + @firebase/testing