Skip to content

Conversation

@cabljac
Copy link
Collaborator

@cabljac cabljac commented Aug 11, 2025

This PR adds a useGetIdTokenQuery hook to the react package.

Copilot AI review requested due to automatic review settings August 11, 2025 11:40
@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2025

🦋 Changeset detected

Latest commit: 8e174ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@dataconnect/default-connector Minor
react-example Minor
useGetIdTokenQuery Minor
@tanstack-query-firebase/react Minor

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

@docs-page
Copy link

docs-page bot commented Aug 11, 2025

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.

gemini-code-assist[bot]

This comment was marked as outdated.

@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch from 0365fcc to 09a064e Compare August 11, 2025 11:43
@cabljac
Copy link
Collaborator Author

cabljac commented Aug 11, 2025

/gemini review please

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

This comment was marked as outdated.

@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch from 0872585 to d4872cb Compare August 11, 2025 17:10
@cabljac cabljac requested a review from Copilot August 11, 2025 17:11

This comment was marked as outdated.

@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch 4 times, most recently from 5b4f99f to ed1954b Compare August 12, 2025 10:14
@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch from ed1954b to 8beed65 Compare August 12, 2025 11:03
@cabljac cabljac requested a review from Copilot August 12, 2025 16:27

This comment was marked as outdated.

@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch from ef5b7d3 to 44112a7 Compare August 13, 2025 08:40
@cabljac cabljac requested a review from Copilot August 13, 2025 10:52

This comment was marked as outdated.

This comment was marked as outdated.

@cabljac cabljac force-pushed the @invertase/useGetIdTokenQuery branch from 9353ea0 to 8e174ab Compare August 18, 2025 09:13
@cabljac cabljac requested a review from Copilot August 18, 2025 09:16
Copy link
Contributor

Copilot AI left a 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 useGetIdTokenQuery hook 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.

@cabljac cabljac merged commit 2589791 into main Aug 18, 2025
4 checks passed
@cabljac cabljac deleted the @invertase/useGetIdTokenQuery branch August 18, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants