Skip to content

fix(shared): Ensure window object existence#2913

Merged
nikosdouvlis merged 2 commits intoclerk:mainfrom
mario-jerkovic:main
Mar 1, 2024
Merged

fix(shared): Ensure window object existence#2913
nikosdouvlis merged 2 commits intoclerk:mainfrom
mario-jerkovic:main

Conversation

@mario-jerkovic
Copy link
Copy Markdown
Contributor

Description

Fixes #2911

This PR addresses an issue within the shared module where the window object was being accessed before verifying its existence. This premature access caused errors in environments where window is not defined, such as server-side rendering (SSR) contexts or Node.js environments. The proposed changes ensure that the browser validity check correctly precedes any reference to window.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • [] (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 1, 2024

🦋 Changeset detected

Latest commit: 4dcb11d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/shared Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/clerk-expo Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
gatsby-plugin-clerk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LekoArts LekoArts changed the title fix(shared): Ensure window object existence before accessing its prop… fix(shared): Ensure window object existence Mar 1, 2024
Copy link
Copy Markdown
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@LekoArts LekoArts requested a review from nikosdouvlis March 1, 2024 13:52
Copy link
Copy Markdown
Member

@nikosdouvlis nikosdouvlis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mario-jerkovic A solid report and a follow-up PR with a fix, can't ask for much more 🥇
Thank you!

@nikosdouvlis nikosdouvlis merged commit 2ec9f6b into clerk:main Mar 1, 2024
nikosdouvlis pushed a commit that referenced this pull request Mar 1, 2024
* fix(shared): Ensure window object existence before accessing its properties

* add changeset

---------

Co-authored-by: Lennart <lekoarts@gmail.com>

(cherry picked from commit 2ec9f6b)
LekoArts added a commit that referenced this pull request Mar 13, 2024
* fix(shared): Ensure window object existence before accessing its properties

* add changeset

---------

Co-authored-by: Lennart <lekoarts@gmail.com>
(cherry picked from commit 2ec9f6b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@clerk/clerk-js throw exception in headles non-browser environment

3 participants