Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clerk-js): Fix unsafe window.addEventListener() call #3097

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

BRKalow
Copy link
Member

@BRKalow BRKalow commented Apr 2, 2024

Description

Fixes a customer-reported issue where we were attempting to call window.addEventListener() via our Expo SDK.

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:

Copy link

changeset-bot bot commented Apr 2, 2024

🦋 Changeset detected

Latest commit: e53143b

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo 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

@BRKalow
Copy link
Member Author

BRKalow commented Apr 2, 2024

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @BRKalow - the snapshot version command generated the following package versions:

Package Version
@clerk/backend 1.0.1-snapshot.ve53143b
@clerk/chrome-extension 1.0.1-snapshot.ve53143b
@clerk/clerk-js 5.0.1-snapshot.ve53143b
@clerk/clerk-expo 1.0.1-snapshot.ve53143b
@clerk/fastify 1.0.1-snapshot.ve53143b
gatsby-plugin-clerk 5.0.1-snapshot.ve53143b
@clerk/localizations 2.0.1-snapshot.ve53143b
@clerk/nextjs 5.0.1-snapshot.ve53143b
@clerk/clerk-react 5.0.1-snapshot.ve53143b
@clerk/remix 4.0.1-snapshot.ve53143b
@clerk/clerk-sdk-node 5.0.1-snapshot.ve53143b
@clerk/shared 2.0.1-snapshot.ve53143b
@clerk/themes 2.0.1-snapshot.ve53143b
@clerk/types 4.0.1-snapshot.ve53143b

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/clerk-expo

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

gatsby-plugin-clerk

npm i [email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/clerk-react

npm i @clerk/[email protected] --save-exact

@clerk/remix

npm i @clerk/[email protected] --save-exact

@clerk/clerk-sdk-node

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/themes

npm i @clerk/[email protected] --save-exact

@clerk/types

npm i @clerk/[email protected] --save-exact

@BRKalow BRKalow changed the title fix(clerk-js): Ensure we don't access window.addEventListener() in no… fix(clerk-js): Fix unsafe window.addEventListener() call Apr 3, 2024
@@ -722,16 +722,16 @@ export class Clerk implements ClerkInterface {
// undefined, then wait for beforeEmit to complete before emitting the new session.
// When undefined, neither SignedIn nor SignedOut renders, which avoids flickers or
// automatic reloading when reloading shouldn't be happening.
const beforeUnloadTracker = createBeforeUnloadTracker();
const beforeUnloadTracker = this.#options.standardBrowser ? createBeforeUnloadTracker() : undefined;
Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively, have the factory function accept an argument to indicate whether or not it's a web browser environment.

@BRKalow BRKalow marked this pull request as ready for review April 3, 2024 03:38
Copy link
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.

Nice

@nikosdouvlis nikosdouvlis merged commit 4705d63 into main Apr 3, 2024
10 checks passed
@nikosdouvlis nikosdouvlis deleted the brk.fix/expo-window-access branch April 3, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants