-
Notifications
You must be signed in to change notification settings - Fork 401
chore(clerk-js,types,clerk-react,astro,vue): Remove treatPendingAsSignedOut as Clerk option
#6497
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: 48d7fd8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
a3fa937 to
839d463
Compare
839d463 to
01ec690
Compare
📝 WalkthroughWalkthroughThis change removes the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (9)
💤 Files with no reviewable changes (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (6)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
01ec690 to
672e8d1
Compare
treatPendingAsSignedOut as Clerk optiontreatPendingAsSignedOut as Clerk option
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.
Actionable comments posted: 0
🔭 Outside diff range comments (3)
packages/vue/src/composables/useAuth.ts (1)
76-115: Tests missing for pending-session behavior in Vue composableAdd tests ensuring
useAuth({ /* any value */ }).isSignedIn === falsewhen session ispending.I can scaffold unit tests for this composable; let me know your preferred test runner.
packages/react/src/hooks/useAuth.ts (1)
95-124: Add tests to assert pending-session semantics in ReactPlease add/adjust tests to assert
useAuth().isSignedIn === falsewhen session is pending, regardless of passed options.packages/clerk-js/src/core/clerk.ts (1)
361-368: Remove remainingtreatPendingAsSignedOutoptions and add gating testsThe grep run shows many leftover
treatPendingAsSignedOutdefinitions/usages and docs entries across the monorepo. Before merging, please:• Remove
treatPendingAsSignedOutfrom all packages (vue, react, astro, nextjs, shared, types, backend)
– Delete the option types, prop definitions and default-true fallbacks
– Clean up any CHANGELOG/docs/examples that mention it or the old env var
• Add a unit test inpackages/clerk-jsto assert:
Clerk.isSignedInreturnsfalsewhensession.status === 'pending'
• Add control-component tests in each client package to verify that pending sessions are treated as signed-out by default:<SignedIn>and<Protect>do not render their children when status ispending<SignedOut>renders correctly under a pending session
🧹 Nitpick comments (4)
packages/astro/src/integration/create-integration.ts (1)
165-186: Env schema consistency checkSchema no longer includes the removed env. Good. Consider adding a migration note in docs pointing users to the new behavior (pending => signed-out always).
I can draft the doc/migration note PR snippet if helpful.
packages/react/src/hooks/useAuth.ts (1)
38-39: Docs/JSDoc follow-upThe JSDoc mentions
treatPendingAsSignedOutwith defaulttrue. If the option is no longer honored, mark it deprecated or clarify it has no effect and pending is always treated as signed-out.I can update the JSDoc/comment block accordingly.
packages/astro/src/react/hooks.ts (1)
58-60: Type surface follow-upIf we enforce the behavior, consider deprecating
PendingSessionOptions.treatPendingAsSignedOutin types used by this hook (non-breaking now; remove in next major).packages/clerk-js/src/core/clerk.ts (1)
361-368: Minor: drop optional chaining onthis; add concise JSDoc clarifying semantics
- Inside class methods,
thisis always defined; preferthis.session?.statusoverthis?.session?.statusfor clarity.Apply this tiny cleanup:
-const hasPendingSession = this?.session?.status === 'pending'; +const hasPendingSession = this.session?.status === 'pending';And consider documenting the public getter to avoid ambiguity:
/** * True when an active, non-pending session is present. * Sessions with status 'pending' are treated as signed out. */ get isSignedIn(): boolean;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
packages/astro/src/env.d.ts(0 hunks)packages/astro/src/integration/create-integration.ts(1 hunks)packages/astro/src/react/hooks.ts(1 hunks)packages/clerk-js/src/core/clerk.ts(1 hunks)packages/react/src/hooks/useAuth.ts(1 hunks)packages/types/src/clerk.ts(2 hunks)packages/vue/src/composables/useAuth.ts(2 hunks)packages/vue/src/plugin.ts(0 hunks)
💤 Files with no reviewable changes (2)
- packages/astro/src/env.d.ts
- packages/vue/src/plugin.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertionsfor literal types:as const
Usesatisfiesoperator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
**/*
⚙️ CodeRabbit Configuration File
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
Files:
packages/astro/src/integration/create-integration.tspackages/vue/src/composables/useAuth.tspackages/types/src/clerk.tspackages/astro/src/react/hooks.tspackages/clerk-js/src/core/clerk.tspackages/react/src/hooks/useAuth.ts
🧬 Code Graph Analysis (1)
packages/types/src/clerk.ts (1)
packages/backend/src/index.ts (1)
ClerkOptions(14-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (tanstack-react-router, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 14)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (elements, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (expo-web, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (quickstart, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
- GitHub Check: Unit Tests (22, **)
- GitHub Check: Static analysis
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (9)
packages/astro/src/integration/create-integration.ts (2)
22-22: Removal oftreatPendingAsSignedOutfrom integration params looks correctParam destructuring aligns with the deprecation and removes env propagation from this layer. No other logic depends on it here.
54-68: No leftoverPUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUTreferences found
Ripgrep confirms zero occurrences of the env var, andpackages/astro/src/integration/create-integration.tsno longer mentionstreatPendingAsSignedOut. No further changes required.packages/vue/src/composables/useAuth.ts (2)
77-77: Removed context fallback is aligned with the deprecationDropping
...contextOptionsensures no implicit fallback is applied. This matches the objective.
103-104: Incorrect suggestion:resolveAuthStatealready defaultstreatPendingAsSignedOuttotrue
TheresolveAuthStatefunction in@clerk/shared/authorizationdestructures its options withoptions: { treatPendingAsSignedOut = true }– so if you omit or pass
undefined, it defaults totrue; only an explicitfalsewill override it. By forwardingoptions.treatPendingAsSignedOuthere, the hook:
- Defaults to treating pending sessions as signed-out (the existing, non-breaking behavior).
- Still honors a developer’s opt-out (
treatPendingAsSignedOut: false) when explicitly set.Hard-coding
truewould remove that opt-out. No changes are needed.Likely an incorrect or invalid review comment.
packages/types/src/clerk.ts (2)
52-52: Import cleanup:PendingSessionOptionsremovalRemoving
PendingSessionOptionsfrom imports is correct and prevents type-level access viaClerkOptions.
965-1085: ClerkOptions type clean – no pending-session option remainsAll occurrences of
treatPendingAsSignedOuthave been removed from the code:
- No
__internal_getOption('treatPendingAsSignedOut')calls found.- No JSDoc or type declarations reference
treatPendingAsSignedOut.(Change-log entries still document its removal as part of historical notes.)
packages/react/src/hooks/useAuth.ts (1)
121-122: Ignore enforcement/deprecation suggestion for treatPendingAsSignedOut passthroughThe
treatPendingAsSignedOutflag is still actively used byresolveAuthState(defaulting totrue) to allow opt-out (false) behavior. Tests inpackages/react/src/hooks/__tests__/useAuth.test.tsxand the implementation inpackages/shared/src/authorization.ts:256–264confirm that passing the user’s value is required and working as intended. No change is needed.Likely an incorrect or invalid review comment.
packages/astro/src/react/hooks.ts (1)
120-121: Unable to locatetreatPendingAsSignedOut– please confirm
I ran a repo-wide search and didn’t find any references totreatPendingAsSignedOutor the relatedPUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUTenv var.
• If this flag has already been removed or renamed, you can disregard the suggested refactor.
• If it’s still present in your Astro hooks or auth resolver, please choose one of the two options to enforce consistent AIO gating:
– HardcodetreatPendingAsSignedOut: truein the options object.
– UpdateresolveAuthStateto ignore the flag and clean up types later.packages/clerk-js/src/core/clerk.ts (1)
361-368: Align isSignedIn behavior: pending -> false (unconditional) — LGTMThis matches the PR objective and ensures consistent gating in control/AIO components.
672e8d1 to
48d7fd8
Compare
Description
Context
treatPendingAsSignedOutwas first introduced in order to allow for control components and applications protection in general, to considerpendingas signed-out by default, but allowing developers to opt-out.Why removing as an option
Clerk.isSignedInshould always returnfalseif the session ispendingin order to gate UI that is protected from an active session, without tasks.Our AIO components are going to rely on it. If the developer passes
treatPendingAsSignedOut: falsetoClerkProvider, it'd break the whole flow and this wouldn't render:Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
treatPendingAsSignedOutoption and all related fallback logic across React, Vue, Astro, and core packages.