Skip to content

Conversation

@SarahSoutoul
Copy link
Contributor

@SarahSoutoul SarahSoutoul commented Jan 21, 2026

🔎 Previews:

What does this solve?

Linear.

This PR is a follow up from an external contributor PR, that renamed the deprecated activeSessions property to signedInSessions.

While reviewing that PR, @manovotny and I discovered that the type of signedInSessions didn't seem right. On the JS repo, it shows that signedInSessions is typed as SignedInSession[], but the docs currently list it as Session[].

However, after further investigating while working on this ticket, it became clear that SignedInSession[] is a more specific version of Session[], narrowing the session type to user-associated sessions with well-defined sign-in states.

So what I ended up doing is the following:

  • Changed the type of signedInSessions to be SignedInSession[] instead of Session[], but it still links to the Session object page. This is actually already done on this page for e..g: https://clerk.com/docs/nextjs/reference/hooks/use-session.
  • Improved the description of signedInSessions to be clearer.
  • Noticed some properties and methods were missing for the Client object, so documented these as well.
  • Moved properties around to ensure they are in alphabetical order.
  • Added some refs to simplify the links.

@SarahSoutoul SarahSoutoul self-assigned this Jan 21, 2026
@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-docs Ready Ready Preview Jan 21, 2026 8:50pm

Request Review

@SarahSoutoul SarahSoutoul marked this pull request as ready for review January 21, 2026 19:37
@SarahSoutoul SarahSoutoul requested a review from a team as a code owner January 21, 2026 19:37
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

#### Example

```js
await clerk.client.isNew()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the await here unnecessary or does line 93 need to change to function isNew(): Promise<boolean>?

#### Example

```js
await clerk.client.clearCache()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the isNew() comment. Is the await here unnecessary or does line 149 need to change to return a promise?

Clears any locally cached session data for the current client.

```typescript
function clearCache(): () => void
Copy link
Contributor

Choose a reason for hiding this comment

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

function and arrow function here seems wrong, unless clearCache returns a function?

#### Example

```js
await clerk.client.isEligibleForTouch()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here. Does it return a boolean or Promise<boolean>?

Builds a URL that refreshes the current client's authentication state and then redirects the user to the specified URL.

```typescript
function buildTouchUrl(): (params: { redirectUrl: URL }) => string
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here. Are we returning a string or a function that returns a string?

#### Example

```js
await clerk.client.buildTouchUrl({ redirectUrl: '/' })
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it return a string or Promise<string>?

Co-authored-by: Michael Novotny <manovotny@gmail.com>
@SarahSoutoul
Copy link
Contributor Author

@manovotny to answer all of your comments, here is what there is in the JS repo:

Screenshot 2026-01-21 at 2 53 52 pm

So the following methods don't return Promises like create, or destroy:

  • isNew()
  • clearCache()
  • isEligibleForTouch()
  • buildTouchUrl()

Since they're not returning Promises, it makes sense to remove the await. I was following the way we write our examples for the other JS objects, but most of the methods for those return Promises to be honest.

For the following comment: function and arrow function here seems wrong, unless clearCache returns a function?, this is what we have in the JS repo and I then followed how that's translated in our docs for other methods:

Screenshot 2026-01-21 at 2 52 58 pm Screenshot 2026-01-21 at 2 53 22 pm Screenshot 2026-01-21 at 2 52 27 pm

@manovotny
Copy link
Contributor

@manovotny to answer all of your comments, here is what there is in the JS repo:

So the following methods don't return Promises like create, or destroy:

  • isNew()
  • clearCache()
  • isEligibleForTouch()
  • buildTouchUrl()

Since they're not returning Promises, it makes sense to remove the await. I was following the way we write our examples for the other JS objects, but most of the methods for those return Promises to be honest.

Let's solve the easy problems first. 😅 If there's no promises, then let's not await. 🤝

For the following comment: function and arrow function here seems wrong, unless clearCache returns a function?, this is what we have in the JS repo and I then followed how that's translated in our docs for other methods:

These get more complicated.

  1. I think our JS code is not quite right. Take clearCache, for example:
clearCache(): void {
  return this.sessions.forEach(s => s.clearCache());
}

There shouldn't be a return statement (we're staying void) and forEach actually returns undefined.

  1. I think we're unintentionally communicating the wrong thing. What we have indicates we're returning a function, which then needs to be called to get the primitive.
CleanShot 2026-01-21 at 15 37 36@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants