Skip to content

Conversation

tmilewski
Copy link
Member

@tmilewski tmilewski commented Jun 23, 2025

Description

Re-export useReverification hook from @clerk/clerk-react

USER-2128

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added the useReverification hook for use in Expo projects.
  • Documentation

    • Updated documentation to reflect the addition of the useReverification hook.
  • Refactor

    • Improved type handling for error responses in backend mock server responses.

@tmilewski tmilewski self-assigned this Jun 23, 2025
Copy link

changeset-bot bot commented Jun 23, 2025

🦋 Changeset detected

Latest commit: c693a5f

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

This PR includes changesets to release 1 package
Name Type
@clerk/clerk-expo 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

Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 6:23pm

@tmilewski tmilewski changed the title fix(expo): Re-export useReverification hook fix(clerk-expo): Re-export useReverification hook Jun 23, 2025
@tmilewski tmilewski changed the title fix(clerk-expo): Re-export useReverification hook fix(clerk-expo): Re-export useReverification hook Jun 23, 2025
Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

📝 Walkthrough

Walkthrough

This change introduces a re-export of the useReverification hook from the @clerk/clerk-react package in the @clerk/clerk-expo package by updating the packages/expo/src/hooks/index.ts file. Additionally, a changeset file is added to document this minor update. Separately, type assertions are added to the JSON response bodies in the validateHeaders function within packages/backend/src/mock-server.ts to ensure the returned objects conform to the expected response type, without altering the control flow or logic.

Assessment against linked issues

Objective Addressed Explanation
Re-export useReverification in Expo (@clerk/clerk-expo) (USER-2128)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add type assertions to JSON response bodies (packages/backend/src/mock-server.ts) This change is unrelated to the objective of re-exporting useReverification in Expo.

Possibly related PRs


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/backend/src/mock-server.ts (1)

22-22: Consider improving type safety for error responses.

The as unknown as ResponseBodyType pattern bypasses TypeScript's type checking and may lead to runtime issues if callers expect the generic ResponseBodyType structure but receive error objects with error and message properties.

Consider defining a proper error response type:

+type ErrorResponse = {
+  error: string;
+  message: string;
+};
+
+type ApiResponse<T> = T | ErrorResponse;

export function validateHeaders<
  Params extends PathParams,
  RequestBodyType extends DefaultBodyType,
- ResponseBodyType extends DefaultBodyType,
+ ResponseBodyType extends DefaultBodyType,
>(
- resolver: HttpResponseResolver<Params, RequestBodyType, ResponseBodyType>,
-): HttpResponseResolver<Params, RequestBodyType, ResponseBodyType> {
+ resolver: HttpResponseResolver<Params, RequestBodyType, ResponseBodyType>,
+): HttpResponseResolver<Params, RequestBodyType, ApiResponse<ResponseBodyType>> {

This approach provides better type safety and makes the error response structure explicit.

Also applies to: 31-31, 40-40

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62ca696 and c693a5f.

📒 Files selected for processing (3)
  • .changeset/fair-ways-create.md (1 hunks)
  • packages/backend/src/mock-server.ts (3 hunks)
  • packages/expo/src/hooks/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
`**/*.{js,ts,tsx,jsx}`: All code must pass ESLint checks with the project's configuration. Use Prettier for consistent code formatting.

**/*.{js,ts,tsx,jsx}: All code must pass ESLint checks with the project's configuration.
Use Prettier for consistent code formatting.

  • packages/expo/src/hooks/index.ts
  • packages/backend/src/mock-server.ts
`**/*.{ts,tsx}`: Maintain comprehensive JSDoc comments for public APIs.

**/*.{ts,tsx}: Maintain comprehensive JSDoc comments for public APIs.

  • packages/expo/src/hooks/index.ts
  • packages/backend/src/mock-server.ts
`packages/**`: All publishable packages under the @clerk namespace must be located in the packages/ directory.

packages/**: All publishable packages under the @clerk namespace must be located in the packages/ directory.

  • packages/expo/src/hooks/index.ts
  • packages/backend/src/mock-server.ts
`**/index.ts`: Use index.ts files for clean imports but avoid deep barrel exports.

**/index.ts: Use index.ts files for clean imports but avoid deep barrel exports.

  • packages/expo/src/hooks/index.ts
`**/*.ts`: Always define explicit return types for functions, especially public APIs. Use proper type annotations for variables and parameters where inference isn't clear. Avoid `a...

**/*.ts: Always define explicit return types for functions, especially public APIs.
Use proper type annotations for variables and parameters where inference isn't clear.
Avoid any type; prefer unknown when type is uncertain, then narrow with type guards.
Use interface for object shapes that might be extended; use type for unions, primitives, and computed types.
Prefer readonly properties for immutable data structures.
Use private for internal implementation details, protected for inheritance, and public explicitly for clarity in public APIs.
Prefer composition and interfaces over deep inheritance chains; use mixins for shared behavior.
Use ES6 imports/exports consistently; avoid barrel files (index.ts re-exports) to prevent circular dependencies.
Use type-only imports (import type { ... }) where possible.
Use as const for literal types and the satisfies operator for type checking without widening.
Enable --incremental and --tsBuildInfoFile for faster builds.
Use ESLint with @typescript-eslint/recommended rules and Prettier for formatting.
Use lint-staged and Husky for pre-commit checks.
Use type-coverage to measure type safety.

  • packages/expo/src/hooks/index.ts
  • packages/backend/src/mock-server.ts
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
packages/expo/src/hooks/index.ts (1)

11-11: ```shell
#!/bin/bash

Check how hooks are re-exported from the main entry point in @clerk/clerk-react

List all export statements in the React package entrypoint

rg -n "^export" packages/react/src/index.ts

Specifically look for wildcard exports from hooks

rg -n "from './hooks'" packages/react/src/index.ts


</details>
<details>
<summary>.changeset/fair-ways-create.md (1)</summary>

`1-6`: **LGTM! Changeset properly documents the update.**

The changeset correctly identifies this as a minor version bump for `@clerk/clerk-expo` and accurately describes the re-export of the `useReverification` hook. The format follows changeset conventions.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

pkg-pr-new bot commented Jun 23, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6182

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6182

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6182

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6182

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6182

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6182

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6182

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6182

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6182

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6182

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6182

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6182

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6182

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6182

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6182

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6182

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6182

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6182

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6182

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6182

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6182

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6182

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6182

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6182

commit: c693a5f

Copy link
Member

@jacekradko jacekradko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we should probably start snapshoting the public API being exported from this package

@tmilewski
Copy link
Member Author

@jacekradko Agreed. I tried, but it was having issues with Expo so I punted for the time being.

@tmilewski tmilewski merged commit 55e8fca into main Jun 23, 2025
66 of 69 checks passed
@tmilewski tmilewski deleted the tm/user-2128-reexport-use-reverification branch June 23, 2025 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants