Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Nov 5, 2025

Description

I believe we should have sessionClaims in the dependency array here, otherwise we'll get outdated features and plans if sessionClaims changes

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

  • Bug Fixes
    • Ensures derived authentication checks update when session information changes, fixing cases where auth-derived state could become out of sync.

@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

🦋 Changeset detected

Latest commit: 8131605

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

This PR includes changesets to release 8 packages
Name Type
@clerk/clerk-react Patch
@clerk/chrome-extension Patch
@clerk/elements Patch
@clerk/clerk-expo Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch

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

@vercel
Copy link

vercel bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Nov 6, 2025 2:30pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Walkthrough

Added sessionClaims to the memoization dependency array for the derivedHas function inside the useAuth hook so the memoized callback is recreated when sessionClaims changes. No other logic or public API changes.

Changes

Cohort / File(s) Summary
useAuth hook fix
packages/react/src/hooks/useAuth.ts
Added sessionClaims to the dependency array of the memoized derivedHas callback to align dependencies with internal usage.
Release notes / changeset
.changeset/shiny-taxis-give.md
Added a changeset entry describing the dependency-array fix in useAuth for a patch release.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verification needed: confirm sessionClaims is the only missing dependency and that adding it does not introduce unintended re-renders.

Poem

🐰 A claim was missing, hidden from the view,
I hopped through the code and added what was due.
Now callbacks wake when their claims rearrange,
Small fix, steady heart — the memo's in its range. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: correcting a dependency array in useAuth by adding sessionClaims, which is exactly what the changeset implements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/correct-use-auth-deoendency-array

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 89ce307 and 8131605.

📒 Files selected for processing (1)
  • .changeset/shiny-taxis-give.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/shiny-taxis-give.md

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 5, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 8131605

@blacksmith-sh

This comment has been minimized.

@jacekradko jacekradko changed the title fix(react): Correct dependency array in useAuth fix(clerk-react): Correct dependency array in useAuth Nov 6, 2025
@jacekradko jacekradko merged commit 92fba5d into main Nov 6, 2025
42 checks passed
@jacekradko jacekradko deleted the feat/correct-use-auth-deoendency-array branch November 6, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants