-
Notifications
You must be signed in to change notification settings - Fork 72
feat(react): useGetIdTokenQuery #201
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
🦋 Changeset detectedLatest commit: 8e174ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
To view this pull requests documentation preview, visit the following URL: docs.page/invertase/tanstack-query-firebase~201 Documentation is deployed and generated using docs.page. |
0365fcc to
09a064e
Compare
|
/gemini review please |
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 introduces a new useGetIdTokenQuery hook for React, which is a great addition for handling user authentication tokens. The implementation is solid, with good defaults for token caching and clear documentation. The PR also includes significant improvements to the project's tooling, such as setting up Changesets for versioning, Turborepo for monorepo management, and refining the Biome configuration for consistent code style. These changes will greatly benefit the project's maintainability. My review includes a suggestion to improve the error handling consistency in the new hook.
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 introduces a new React hook, useGetIdTokenQuery, for retrieving Firebase user ID tokens with TanStack Query. The implementation is solid, with good handling of caching, forceRefresh options, and user states. The accompanying tests cover the main functionalities.
My feedback focuses on improving the clarity of the JSDoc and test descriptions to prevent potential misuse of the hook. Specifically, I've pointed out that refetch() doesn't necessarily force a token refresh and that some test names could be more descriptive of what they are actually testing. There are also a number of formatting changes across the dataconnect-sdk which appear to be from an automated tool and have no functional impact.
0872585 to
d4872cb
Compare
5b4f99f to
ed1954b
Compare
ed1954b to
8beed65
Compare
ef5b7d3 to
44112a7
Compare
9353ea0 to
8e174ab
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 adds the useGetIdTokenQuery hook to the React package for retrieving Firebase ID tokens with TanStack Query integration. The implementation includes comprehensive testing, example applications, and documentation.
- Implements
useGetIdTokenQueryhook with intelligent caching and force refresh capabilities - Adds complete test suite covering various scenarios including caching, error handling, and token refresh
- Includes a comprehensive example application demonstrating different usage patterns
Reviewed Changes
Copilot reviewed 31 out of 55 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/auth/useGetIdTokenQuery.ts | Main hook implementation with caching logic and Firebase integration |
| packages/react/src/auth/useGetIdTokenQuery.test.tsx | Comprehensive test suite covering all hook functionality |
| packages/react/src/auth/index.ts | Exports the new hook from auth module |
| examples/react/useGetIdTokenQuery/ | Complete example application demonstrating hook usage |
| docs/react/auth/hooks/useGetIdTokenQuery.mdx | Comprehensive documentation with usage examples |
| packages/react/package.json | Updates export paths to include dist directory |
| packages/react/vitest.config.ts | Adds happy-dom environment for better React testing |
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.
This PR adds a useGetIdTokenQuery hook to the react package.