You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed connectivity checks in MV3 extension background service workers so online/offline status is detected correctly; SSR without a navigator still reports offline.
Tightened WebAuthn detection to avoid false positives in environments that lack a window object.
Tests
Added service-worker-like tests and expanded online/offline coverage for browser detection.
Documentation
Updated changelog entry documenting the connectivity heuristic fix.
Reviewing files that changed from the base of the PR and between d8b3d24 and ca5e2d0.
📒 Files selected for processing (5)
.changeset/shared-navigator-service-worker.md
packages/clerk-js/bundlewatch.config.json
packages/shared/src/__tests__/browser.spec.ts
packages/shared/src/browser.ts
packages/shared/src/webauthn.ts
✅ Files skipped from review due to trivial changes (1)
.changeset/shared-navigator-service-worker.md
🚧 Files skipped from review as they are similar to previous changes (4)
packages/clerk-js/bundlewatch.config.json
packages/shared/src/webauthn.ts
packages/shared/src/browser.ts
packages/shared/src/tests/browser.spec.ts
📝 Walkthrough
Walkthrough
This PR centralizes navigator resolution in a new getNavigator() helper so isValidBrowser() and isBrowserOnline() read from window.navigator or self.navigator (worker scopes). WebAuthn detection now requires window. Tests add a service-worker mock and cover SSR and worker online/offline cases; a changeset and a tiny bundlewatch size bump were included.
getNavigator() helper centralizes navigator retrieval from window.navigator or self.navigator for worker environments. isValidBrowser() and isBrowserOnline() now source navigator from this helper.
isWebAuthnSupported() now explicitly requires typeof window !== 'undefined' alongside existing isValidBrowser() and PublicKeyCredential checks.
Test infrastructure and coverage packages/shared/src/__tests__/browser.spec.ts
Adds mockServiceWorkerScope() to simulate WorkerGlobalScope and extends tests for isValidBrowser and isValidBrowserOnline covering service worker (no window, self.navigator present) and SSR (no window, no WorkerGlobalScope) scenarios. Updates cleanup to call vi.unstubAllGlobals().
Increases maxSize for ./dist/clerk.browser.js slightly (71.18KB → 71.24KB).
🎯 3 (Moderate) | ⏱️ ~25 minutes
🐰 In service workers bright and new,
Where window hides from distant view,
Our navigator takes the lead,
To find online when most we need,
No more misleading clerk_offline plead! 🔌
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The PR title accurately describes the main change: adding support for reading global navigator when window is unavailable in isValidBrowser and related functions to fix service worker connectivity checks.
Docstring Coverage
✅ Passed
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
Comment @coderabbitai help to get the list of available commands and usage tips.
royanger
changed the title
fix: Added support for global navigator check to isValidBrowserfix(shared): Added support for global navigator check to isValidBrowserJun 11, 2026
Generated by Break Check on 2026-06-11T23:24:00.832Z
Summary
Metric
Count
Packages analyzed
19
Packages with changes
0
🔴 Breaking changes
0
🟡 Non-breaking changes
0
🟢 Additions
0
Note
Break Check could not snapshot 3 subpaths; the diff below excludes them.
@clerk/astro ./env: Internal Error: Unable to determine module for: /home/runner/_work/javascript/javascript/packages/astro/env.d.ts You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
@clerk/shared ./cookie: Internal Error: Unable to follow symbol for "Cookies" You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
@clerk/testing ./cypress: Symbol not found for identifier: Cypress
No API Changes Detected
All packages have stable APIs with no detected changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Bug Fixes
Tests
Documentation