File tree 7 files changed +18
-11
lines changed
7 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 8
8
' @clerk/vue ' : minor
9
9
---
10
10
11
- Surface new ` pending ` session as an signed-in state, similarly as ` active `
11
+ Surface new ` pending ` session as a signed-in state
Original file line number Diff line number Diff line change 4
4
5
5
- Initialize new ` pending ` session status as an signed-in state
6
6
- Deprecate ` Clerk.client.activeSessions ` in favor of ` Clerk.client.signedInSessions `
7
+ - Introduce ` Clerk.isSignedIn ` property as an explicit signed-in state check, instead of ` !!Clerk.session ` or ` !!Clerk.user ` :
8
+
9
+ ``` ts
10
+ - if (Clerk .user ) {
11
+ + if (Clerk .isSignedIn ) {
12
+ // Mount user button component
13
+ document .getElementById (' signed-in' ).innerHTML = `
14
+ <div id="user-button"></div>
15
+ `
16
+
17
+ const userbuttonDiv = document .getElementById (' user-button' )
18
+
19
+ clerk .mountUserButton (userbuttonDiv )
20
+ }
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export const createClientUatCookie = (cookieSuffix: string): ClientUatCookieHand
38
38
// '0' indicates the user is signed out
39
39
let val = '0' ;
40
40
41
- if ( client && client . updatedAt && client . isSignedIn ) {
41
+ if ( client && client . updatedAt && client . signedInSessions . length > 0 ) {
42
42
// truncate timestamp to seconds, since this is a unix timestamp
43
43
val = Math . floor ( client . updatedAt . getTime ( ) / 1000 ) . toString ( ) ;
44
44
}
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ export class Clerk implements ClerkInterface {
289
289
}
290
290
291
291
get isSignedIn ( ) : boolean {
292
- return ! ! this . client ?. isSignedIn ;
292
+ return ! ! this . session ;
293
293
}
294
294
295
295
public constructor ( key : string , options ?: DomainOrProxyUrl ) {
Original file line number Diff line number Diff line change @@ -118,10 +118,6 @@ export class Client extends BaseResource implements ClientResource {
118
118
return this . _basePostBypass ( { body : params , path : this . path ( ) + '/verify' } ) ;
119
119
}
120
120
121
- get isSignedIn ( ) {
122
- return ( this . signedInSessions ?? [ ] ) . length > 0 ;
123
- }
124
-
125
121
fromJSON ( data : ClientJSON | ClientJSONSnapshot | null ) : this {
126
122
if ( data ) {
127
123
this . id = data . id ;
Original file line number Diff line number Diff line change @@ -128,9 +128,7 @@ export interface Clerk {
128
128
isStandardBrowser : boolean | undefined ;
129
129
130
130
/**
131
- * Indicates whether the current user has a valid, fully signed-in client session.
132
- * A session is considered valid when the user has successfully authenticated,
133
- * completed all required authentication factors, and resolved all pending tasks.
131
+ * Indicates whether the current user has a valid signed-in client session
134
132
*/
135
133
isSignedIn : boolean ;
136
134
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import type { ClientJSONSnapshot } from './snapshots';
7
7
export interface ClientResource extends ClerkResource {
8
8
sessions : SessionResource [ ] ;
9
9
signedInSessions : ( ActiveSessionResource | PendingSessionResource ) [ ] ;
10
- isSignedIn : boolean ;
11
10
signUp : SignUpResource ;
12
11
signIn : SignInResource ;
13
12
isNew : ( ) => boolean ;
You can’t perform that action at this time.
0 commit comments