Skip to content

Commit 9de4869

Browse files
committed
chore: add changeset
1 parent 640e362 commit 9de4869

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎.changeset/sparkly-aliens-see.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
'@clerk/tanstack-react-start': major
3+
'@clerk/react-router': major
4+
'@clerk/clerk-js': major
5+
'@clerk/upgrade': major
6+
'@clerk/nextjs': major
7+
'@clerk/shared': major
8+
'@clerk/react': major
9+
'@clerk/nuxt': major
10+
'@clerk/vue': major
11+
---
12+
13+
`getToken()` now throws `ClerkOfflineError` instead of returning `null` when the client is offline.
14+
15+
This makes it explicit that a token fetch failure was due to network conditions, not authentication state. Previously, returning `null` could be misinterpreted as "user is signed out," potentially causing the cached token to be cleared.
16+
17+
To handle this change, catch `ClerkOfflineError` from `getToken()` calls:
18+
19+
```typescript
20+
import { ClerkOfflineError } from '@clerk/react/errors';
21+
22+
try {
23+
const token = await session.getToken();
24+
} catch (error) {
25+
if (ClerkOfflineError.is(error)) {
26+
// Handle offline scenario - show offline UI, retry later, etc.
27+
}
28+
throw error;
29+
}
30+
```

0 commit comments

Comments
 (0)