-
Notifications
You must be signed in to change notification settings - Fork 431
Description
Preliminary Checks
-
I have reviewed the documentation: https://clerk.com/docs
-
I have searched for existing issues: https://github.com/clerk/javascript/issues
-
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/vedaterenoglu/nextjs-clerk-template.git
Publishable key
pk_test_bW9kZWwtbG9ic3Rlci0xNS5jbGVyay5hY2NvdW50cy5kZXYk
Description
Started a thread on Discord and then was directed here: https://discord.com/channels/856971667393609759/1466175692575346698
I don't like that this usage of the beforeunload event is forced on me just because I choose to used Clerk. It creates a somewhat annoying UX if the user ever wants to use the browser navigation or refresh button, go through a redirect flow for an integration...or in some cases just navigating pages.
javascript/packages/clerk-js/src/core/auth/safeLock.ts
Lines 8 to 10 in 583f7a9
| window.addEventListener('beforeunload', async () => { | |
| await lock.releaseLock(key); | |
| }); |
At the very least, could you provide a config option to disable it?
Screen.Recording.2026-01-30.at.8.10.33.AM.mov
Environment
System:
OS: macOS 26.2
CPU: (12) arm64 Apple M4 Pro
Memory: 70.84 MB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.22.0 - /Users/bsinger/.local/state/fnm_multishells/55170_1769643612439/bin/node
npm: 10.9.4 - /Users/bsinger/.local/state/fnm_multishells/55170_1769643612439/bin/npm
pnpm: 10.28.2 - /Users/bsinger/.local/state/fnm_multishells/55170_1769643612439/bin/pnpm
Browsers:
Chrome: 144.0.7559.110
Safari: 26.2
npmPackages:
@ai-sdk/openai: ^2.0.87 => 2.0.87
@ai-sdk/react: ^2.0.116 => 2.0.116
@clerk/backend: ^2.20.0 => 2.29.6
@clerk/clerk-react: ^5.53.8 => 5.60.0
@clerk/nextjs: ^6.37.0 => 6.37.0
@clerk/themes: ^2.4.33 => 2.4.41
@convex-dev/migrations: ^0.3.1 => 0.3.1
@dnd-kit/core: ^6.3.1 => 6.3.1
@dnd-kit/sortable: ^10.0.0 => 10.0.0
@dnd-kit/utilities: ^3.2.2 => 3.2.2
@next/third-parties: ^16.0.10 => 16.0.10
@radix-ui/react-icons: ^1.3.2 => 1.3.2
@radix-ui/react-toggle-group: ^1.1.11 => 1.1.11
@radix-ui/themes: ^3.2.1 => 3.2.1
@sentry/nextjs: ^10.32.0 => 10.32.0
@tanstack/react-query: ^5.90.12 => 5.90.12
@tanstack/react-table: ^8.21.3 => 8.21.3
@testing-library/jest-dom: ^6.9.1 => 6.9.1
@testing-library/react: ^16.3.1 => 16.3.1
@testing-library/user-event: ^14.6.1 => 14.6.1
@types/lodash: ^4.17.21 => 4.17.21
@types/node: ^22.13.10 => 22.19.1
@types/react: ^19.0.10 => 19.2.7
@types/react-dom: ^19.0.4 => 19.2.3
@vitejs/plugin-react: ^5.1.2 => 5.1.2
@vitest/coverage-v8: ^4.0.16 => 4.0.16
ai: ^5.0.114 => 5.0.114
babel-plugin-react-compiler: ^1.0.0 => 1.0.0
convex: ^1.31.2 => 1.31.2
convex-test: ^0.0.41 => 0.0.41
dotenv: ^16.4.7 => 16.6.1
framer-motion: ^12.23.25 => 12.23.25
husky: ^9.1.7 => 9.1.7
jsdom: ^27.3.0 => 27.3.0
lodash: ^4.17.21 => 4.17.23
msw: ^2.12.4 => 2.12.4
next: ^16.0.1 => 16.1.6
npm-run-all: ^4.1.5 => 4.1.5
oxfmt: ^0.27.0 => 0.27.0
oxlint: ^1.33.0 => 1.33.0
patch-package: ^8.0.1 => 8.0.1
postcss: ~8 => 8.5.6
raw-loader: ^4.0.2 => 4.0.2
react: ^19.2.3 => 19.2.3
react-cookie-consent: ^9.0.0 => 9.0.0
react-day-picker: ^9.12.0 => 9.12.0
react-dom: ^19.2.3 => 19.2.3
react-idle-timer: ^5.7.2 => 5.7.2
react-markdown: ^10.1.0 => 10.1.0
recharts: ^3.5.1 => 3.5.1
snaptrade-typescript-sdk: ^9.0.11 => 9.0.158
sonner: ^2.0.3 => 2.0.7
streamdown: ^1.6.10 => 1.6.11
stripe: ^20.0.0 => 20.0.0
svix: ^1.81.0 => 1.82.0
typescript: ~5.7.2 => 5.7.3
vitest: ^4.0.16 => 4.0.16
zod: ^4.2.1 => 4.2.1