-
Notifications
You must be signed in to change notification settings - Fork 74
refactor(examples): add kitchen-sink example #203
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
base: main
Are you sure you want to change the base?
Conversation
|
To view this pull requests documentation preview, visit the following URL: docs.page/invertase/tanstack-query-firebase~203 Documentation is deployed and generated using docs.page. |
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.
Summary of Changes
Hello @cabljac, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request refactors the React examples by introducing a new "kitchen-sink" application. This comprehensive example consolidates existing authentication examples and adds a new Firestore collection query example, demonstrating various TanStack Query Firebase hooks and patterns within a single, navigable application.
Highlights
- New Kitchen Sink Example: A new
kitchen-sink
example application has been added, serving as a comprehensive showcase for TanStack Query Firebase hooks. - Authentication Example Integration: The existing
useGetIdTokenQuery
example has been integrated into this new application, demonstrating Firebase Authentication token management. - Firestore Collection Query Example: A new Firestore example,
CollectionQueryExample
, has been introduced, showcasinguseCollectionQuery
for data retrieval, along withuseAddDocumentMutation
anduseDeleteDocumentMutation
for data manipulation, including filtering capabilities. - Project Renaming and Restructuring: The project structure has been refactored, renaming the previous
useGetIdTokenQuery
example directory and its associated files to align with the newkitchen-sink
structure. - Enhanced Firebase Emulator Setup: Firebase emulator connections have been enhanced to include both Authentication and Firestore emulators for local development.
- React Router Integration:
react-router-dom
has been integrated to provide client-side routing, allowing seamless navigation between different example sections within the application. - Build Configuration Updates: Build configurations (
vite.config.ts
,tsconfig.json
) and package dependencies (pnpm-lock.yaml
) have been updated to support the new application structure and added libraries.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request refactors the useGetIdTokenQuery
example into a more comprehensive "kitchen-sink" example, which is a great addition for showcasing various features. The new structure with routing is well-organized. I've identified a critical issue with the implementation of the delete mutation that would cause a runtime error, and a high-severity type-safety issue regarding Firestore Timestamps. Additionally, I've provided some suggestions to improve code clarity and performance by adhering to TanStack Query and React best practices.
examples/react/kitchen-sink/src/components/CollectionQueryExample.tsx
Outdated
Show resolved
Hide resolved
examples/react/kitchen-sink/src/components/CollectionQueryExample.tsx
Outdated
Show resolved
Hide resolved
c84d962
to
2b79f00
Compare
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.
Pull Request Overview
This PR refactors the existing examples structure by removing the standalone useGetIdTokenQuery
example and creating a comprehensive "kitchen-sink" example that demonstrates multiple Firebase and TanStack Query integration patterns. The kitchen-sink example includes authentication, Firestore collection queries, nested collections, and TypeScript safety patterns in a single navigable application.
- Consolidates Firebase examples into a single comprehensive demonstration app
- Adds routing and navigation between different Firebase integration patterns
- Extends Firestore security rules to support the new example data structures
Reviewed Changes
Copilot reviewed 20 out of 26 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
firestore.rules | Adds security rules for products, conversations, and tasks collections |
examples/react/useGetIdTokenQuery/* | Removes standalone useGetIdTokenQuery example files |
examples/react/kitchen-sink/* | Creates comprehensive multi-pattern example with routing |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"dev:emulator": "cd ../../../ && firebase emulators:exec --project test-project 'cd examples/react/useGetIdTokenQuery && vite'", | ||
"dev:emulator": "cd ../../../ && firebase emulators:exec --project test-project 'cd examples/react/firebase-examples && vite'", |
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 script path references 'firebase-examples' but the directory is actually 'kitchen-sink'. This will cause the emulator script to fail when trying to change to the correct directory.
"dev:emulator": "cd ../../../ && firebase emulators:exec --project test-project 'cd examples/react/firebase-examples && vite'", | |
"dev:emulator": "cd ../../../ && firebase emulators:exec --project test-project 'cd examples/react/kitchen-sink && vite'", |
Copilot uses AI. Check for mistakes.
console.log(`Would toggle task ${taskId} to ${!currentCompleted}`); | ||
}; | ||
|
||
// Use a mutation for delete with dynamic document reference TODO: why doesn't the library support dynamic document reference? |
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.
This TODO comment should be removed or properly formatted. It appears to be a development note that shouldn't remain in the final code.
// Use a mutation for delete with dynamic document reference TODO: why doesn't the library support dynamic document reference? | |
// Using a mutation for delete with dynamic document reference, as the library currently does not support dynamic document references directly. |
Copilot uses AI. Check for mistakes.
No description provided.