Skip to content

Commit 6ace42d

Browse files
Merge branch 'main' into carp/references-theming-architecture
2 parents d35b15a + a043a15 commit 6ace42d

6 files changed

Lines changed: 31 additions & 22 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.changeset/orange-pandas-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/shared": patch
3+
---
4+
5+
Remove internal tag from publicly re-exported error helpers

.github/workflows/lock-threads.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- cron: '0 0 * * *'
99

1010
permissions:
11-
contents: write # only for delete-branch option
1211
issues: write
1312
pull-requests: write
1413

.github/workflows/validate-renovate-config.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,5 @@ jobs:
1616
- name: Checkout repo
1717
uses: actions/checkout@v4
1818

19-
- name: Setup
20-
id: config
21-
uses: ./.github/actions/init
22-
with:
23-
cache-enabled: true
24-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
25-
turbo-team: ${{ vars.TURBO_TEAM }}
26-
turbo-token: ${{ secrets.TURBO_TOKEN }}
27-
2819
- name: Validate Renovate Config
29-
run: npx --yes --package renovate@latest renovate-config-validator
20+
run: npx --yes --package renovate@43.150.0 renovate-config-validator

packages/clerk-js/vitest.setup.mts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ configure({ asyncUtilTimeout: 5000 });
1010

1111
// Track all timers created during tests to clean them up
1212
const activeTimers = new Set<ReturnType<typeof setTimeout>>();
13+
const activeIntervals = new Set<ReturnType<typeof setInterval>>();
1314
const originalSetTimeout = global.setTimeout;
1415
const originalClearTimeout = global.clearTimeout;
16+
const originalSetInterval = global.setInterval;
17+
const originalClearInterval = global.clearInterval;
1518

1619
// Wrap setTimeout to track all timers
1720
global.setTimeout = ((callback: any, delay?: any, ...args: any[]) => {
@@ -28,15 +31,34 @@ global.clearTimeout = ((timerId?: ReturnType<typeof setTimeout>) => {
2831
}
2932
}) as typeof clearTimeout;
3033

34+
// Wrap setInterval the same way so libraries like @formkit/auto-animate
35+
// (which polls via setInterval and calls requestAnimationFrame inside it)
36+
// cannot leak callbacks past the test environment teardown.
37+
global.setInterval = ((callback: any, delay?: any, ...args: any[]) => {
38+
const intervalId = originalSetInterval(callback, delay, ...args);
39+
activeIntervals.add(intervalId);
40+
return intervalId;
41+
}) as typeof setInterval;
42+
43+
global.clearInterval = ((intervalId?: ReturnType<typeof setInterval>) => {
44+
if (intervalId) {
45+
activeIntervals.delete(intervalId);
46+
originalClearInterval(intervalId);
47+
}
48+
}) as typeof clearInterval;
49+
3150
beforeEach(() => {
3251
activeTimers.clear();
52+
activeIntervals.clear();
3353
});
3454

3555
afterEach(() => {
3656
cleanup();
37-
// Clear all tracked timers to prevent post-test execution
57+
// Clear all tracked timers/intervals to prevent post-test execution
3858
activeTimers.forEach(timerId => originalClearTimeout(timerId));
3959
activeTimers.clear();
60+
activeIntervals.forEach(intervalId => originalClearInterval(intervalId));
61+
activeIntervals.clear();
4062
});
4163

4264
// Store the original method

packages/shared/src/errors/helpers.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,35 +80,27 @@ export function isNetworkError(e: any): boolean {
8080

8181
/**
8282
* Checks if the provided error is either a ClerkAPIResponseError, a ClerkRuntimeError, or a MetamaskError.
83-
*
84-
* @internal
8583
*/
8684
export function isKnownError(error: any): error is ClerkAPIResponseError | ClerkRuntimeError | MetamaskError {
8785
return isClerkAPIResponseError(error) || isMetamaskError(error) || isClerkRuntimeError(error);
8886
}
8987

9088
/**
9189
* Checks if the provided error is a Clerk runtime error indicating a reverification was cancelled.
92-
*
93-
* @internal
9490
*/
9591
export function isReverificationCancelledError(err: any) {
9692
return isClerkRuntimeError(err) && err.code === 'reverification_cancelled';
9793
}
9894

9995
/**
10096
* Checks if the provided error is a Metamask error.
101-
*
102-
* @internal
10397
*/
10498
export function isMetamaskError(err: any): err is MetamaskError {
10599
return 'code' in err && [4001, 32602, 32603].includes(err.code) && 'message' in err;
106100
}
107101

108102
/**
109103
* Checks if the provided error is clerk api response error indicating a user is locked.
110-
*
111-
* @internal
112104
*/
113105
export function isUserLockedError(err: any) {
114106
return isClerkAPIResponseError(err) && err.errors?.[0]?.code === 'user_locked';
@@ -134,8 +126,6 @@ export function isPasswordCompromisedError(err: any) {
134126

135127
/**
136128
* Checks if the provided error is an EmailLinkError.
137-
*
138-
* @internal
139129
*/
140130
export function isEmailLinkError(err: Error): err is EmailLinkError {
141131
return err.name === 'EmailLinkError';

0 commit comments

Comments
 (0)