feat(clerk-js): Send touch intent with session updates (core-2 backport)#8135
Conversation
…ore-2) Backport of e00ec97 from main. Adds optional `intent` parameter to session.touch() to indicate why the touch was triggered (focus, session switch, or org switch). This enables the backend to skip expensive client piggybacking for focus-only touches. Adapted for core-2's different Session implementation which uses _basePost instead of _touchPost/_fetch and has no __internal_touch.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
🦋 Changeset detectedLatest commit: 2bb35df 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 |
@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: |
Update all remaining toHaveBeenCalled() assertions to
toHaveBeenCalledWith({ intent: ... }) for complete coverage
of touch intent propagation across all setActive paths.
Summary
Backport of e00ec97 from main. The backend needs to know why a session touch was triggered so it can skip expensive client piggybacking for focus-only touches. This adds an optional
intentparameter (focus,select_session,select_org) tosession.touch().The core-2 Session implementation is different from main (uses
_basePostinstead of_touchPost/_fetch, no__internal_touchmethod), so this was manually adapted rather than cherry-picked.SessionTouchIntentandSessionTouchParamstypes added to@clerk/sharedSession.touch()accepts optional{ intent }and passes it in the request bodyclerk.tsdetermines intent based on context:focusfor page focus events,select_sessionfor session switches,select_orgfor organization switchesTest plan
swrresolution failure on core-2 (not caused by this PR), but assertions are updated to match🤖 Generated with Claude Code