feat(js): send tab state with session token requests#9215
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 816773d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
API Changes Report
Summary
🔴 Breaking changes index (1)Every breaking change, up front. Full diffs are in the package sections below.
@clerk/uiVersion: 1.25.7 → 1.25.6 Subpath
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughSession token requests now include Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
524fe1a to
816773d
Compare
Why
Session activity counts pretty much every /tokens call as user activity, but backgrounded tabs keep refreshing tokens on a timer, so idle sessions look active. There's nothing on the wire to tell a foreground mint from a background one.
What changed
Non-template session token requests now include a tab_state body param with one of focused, visible or hidden, derived at request time: document.hasFocus() wins, then visibilityState, and the param is omitted when document doesn't exist (service workers, headless runtimes). Template tokens and touch are untouched.
Blockers / related
Merging is safe but releasing isn't yet: FAPI rejects unknown form params with a 422, so this must not go out in a clerk-js release before clerk/clerk_go #20618 is deployed. The Session Minter passes the param through untouched, no changes needed there.