feat(shared,clerk-js): Add better logs for pending session state#8606
Draft
chriscanin wants to merge 1 commit into
Draft
feat(shared,clerk-js): Add better logs for pending session state#8606chriscanin wants to merge 1 commit into
chriscanin wants to merge 1 commit into
Conversation
Sessions in the `pending` state are treated as signed out by the JS SDK (`isSignedIn` returns false, `useAuth` reports the user signed out) while remaining session tasks are completed. Previously this happened silently, forcing developers to debug "signed in but treated as signed out" with no console hint. iOS and Android SDKs already emit a console message in this state via SessionStatusLogger; this brings the JS SDK to parity. Adds `warnPendingSessionStatus` in @clerk/shared and a single call site in `Clerk.updateClient`, gated on `session?.status === 'pending'`. Dedupes via `logger.warnOnce` keyed by the message string (session id + task key), so a new pending session or a task transition surface a fresh log line. MOBILE-428
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: d4654ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sessions in the
pendingstate are treated as signed out by the JS SDK (isSignedInreturns false,useAuthreports the user signed out) while remaining session tasks are completed. Previously this happened silently, forcing developers to debug "signed in but treated as signed out" with no console hint.iOS (
SessionStatusLogger.swift) and Android already emit a console message in this state. This PR brings the JS SDK to parity.Changes
packages/shared/src/internal/clerk-js/sessionTasks.ts— new exportedwarnPendingSessionStatus(session). Mirrors the iOS message format and uses the existinglogger.warnOncehelper (string-keyed dedupe). The session id and current task key are both in the message, so a new pending session or a task transition each surface a fresh log line.packages/clerk-js/src/core/clerk.ts— one call site at the end ofClerk.updateClient, gated onsession?.status === 'pending'. Covers initial page load with a pre-existing pending session,active → pendingtransitions, andpending → pendingtask changes.packages/shared/src/internal/clerk-js/__tests__/sessionTasks.test.tscovers status gating, task-key inclusion, message dedupe, and re-logging when the task key changes.@clerk/sharedand@clerk/clerk-js.Why not extend
warnMissingPendingTaskHandlers?The existing function is a narrower "you forgot to configure
taskUrls/navigate" warning that only fires insidesetActive(). The new function is informational and fires whenever a pending session is observed — different signal, complementary purpose. Both kept.Sample output
Test plan
Docs / quickstart impact
None. The warning is purely informational and silent in the happy path. No API changes.
Linear
MOBILE-428