Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Apr 3, 2025

Description

Part of ORGS-621

Allows to pass treatPendingAsSignedOut as an option to useSession - refer to the following behavior when a session has a pending status:

// sessionId is undefined, since pending is treat as signed-out state (default behavior)
const { sessionId } = useSession() 

// sessionId is defined, since pending is treat as signed-out state (opt-in behavior)
const { sessionId } = useSession({ treatPendingAsSignedOut: true })

Globally changing the default:

<ClerkProvider treatPendingAsSignedOut={false} />

// sessionId as undefined 
useSession()

// sessionId defined - can still override the global 
useSession({ treatPendingAsSignedOut: true })

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:

@LauraBeatris LauraBeatris self-assigned this Apr 3, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 3, 2025

🦋 Changeset detected

Latest commit: 72bb2be

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

This PR includes changesets to release 10 packages
Name Type
@clerk/vue Minor
@clerk/clerk-react Minor
@clerk/nuxt 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 Apr 3, 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 Apr 3, 2025 10:25pm

@LauraBeatris LauraBeatris force-pushed the laura/pending-use-session branch from 46462ad to bf0c85b Compare April 3, 2025 18:12
@LauraBeatris LauraBeatris requested a review from a team April 3, 2025 18:14
@LauraBeatris LauraBeatris marked this pull request as ready for review April 3, 2025 18:14
useAssertWrappedByClerkProvider('useSession');

const session = useSessionContext();
const optionsContext = useOptionsContext();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we use OptionsProvider anywhere except clerk-js ui

Copy link
Member Author

@LauraBeatris LauraBeatris Apr 3, 2025

Choose a reason for hiding this comment

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

My bad! I haven't tested this one against ClerkProvider - Fixed here - I think should be fine to use __internal_getOption again

@LauraBeatris LauraBeatris changed the title chore(vue,clerk-react): Update useSession to handle pending session as signed-out chore(vue,clerk-react): Update useSession to handle pending session as signed-out Apr 3, 2025
Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

This looks good as well, thank you 🫡

@LauraBeatris LauraBeatris force-pushed the laura/pending-use-auth branch from f069ba7 to 6ce7f24 Compare April 3, 2025 21:12
@LauraBeatris
Copy link
Member Author

LauraBeatris commented Apr 3, 2025

I'll rebase this one again after merging the lower branch! Sorry for the temporary messy diff.

@LauraBeatris LauraBeatris force-pushed the laura/pending-use-session branch from 99f56e4 to 72bb2be Compare April 3, 2025 22:24
@LauraBeatris LauraBeatris merged commit a8180ce into main Apr 3, 2025
30 checks passed
@LauraBeatris LauraBeatris deleted the laura/pending-use-session branch April 3, 2025 22:39
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.

5 participants