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): Ensure new session is touched when setActive is called from non-standard browser #1623

Merged
merged 3 commits into from
Aug 25, 2023

Conversation

BRKalow
Copy link
Member

@BRKalow BRKalow commented Aug 22, 2023

Type of change

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

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

Description

  • npm test runs as expected.
  • npm run build runs as expected.
'

Ensures we call this.#touchLastActiveSession() in setActive() when we are in a non-standard browser environment. Practically, this currently applies to react native / expo environments.

As part of adding tests, I also added a small test helper that mocks a "native" runtime environment: mockNativeRuntime(). This can wrap any number of it() or describe() blocks and will ensure that they run as if they are in a non-browser environment.

fixes JS-653

@changeset-bot
Copy link

changeset-bot bot commented Aug 22, 2023

🦋 Changeset detected

Latest commit: ceb8bf9

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/clerk-expo Patch
@clerk/chrome-extension 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

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

✅ Great news! Jit hasn't found any security issues in your PR. Good Job! 🏆

@panteliselef panteliselef marked this pull request as ready for review August 22, 2023 20:25
@panteliselef panteliselef marked this pull request as draft August 22, 2023 20:25
@BRKalow BRKalow force-pushed the brk.fix/expo-set-active-update-token branch from b110286 to c4b749b Compare August 22, 2023 22:40
@BRKalow BRKalow requested a review from anagstef August 22, 2023 22:40
@BRKalow BRKalow marked this pull request as ready for review August 23, 2023 20:24
@BRKalow
Copy link
Member Author

BRKalow commented Aug 23, 2023

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/backend 0.28.0-snapshot.87d921b
@clerk/chrome-extension 0.3.27-snapshot.87d921b
@clerk/clerk-js 4.56.0-snapshot.87d921b
eslint-config-custom 0.3.0
@clerk/clerk-expo 0.18.18-snapshot.87d921b
@clerk/fastify 0.6.4-snapshot.87d921b
gatsby-plugin-clerk 4.4.5-snapshot.87d921b
@clerk/localizations 1.25.0-snapshot.87d921b
@clerk/nextjs 4.23.3-snapshot.87d921b
@clerk/clerk-react 4.24.0-snapshot.87d921b
@clerk/remix 2.10.0-snapshot.87d921b
@clerk/clerk-sdk-node 4.12.3-snapshot.87d921b
@clerk/shared 0.22.0-snapshot.87d921b
@clerk/themes 1.7.5
@clerk/types 3.50.0-snapshot.87d921b

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/backend
npm i @clerk/backend@0.28.0-snapshot.87d921b
# @clerk/chrome-extension
npm i @clerk/chrome-extension@0.3.27-snapshot.87d921b
# @clerk/clerk-js
npm i @clerk/clerk-js@4.56.0-snapshot.87d921b
# eslint-config-custom
npm i eslint-config-custom@0.3.0
# @clerk/clerk-expo
npm i @clerk/clerk-expo@0.18.18-snapshot.87d921b
# @clerk/fastify
npm i @clerk/fastify@0.6.4-snapshot.87d921b
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.4.5-snapshot.87d921b
# @clerk/localizations
npm i @clerk/localizations@1.25.0-snapshot.87d921b
# @clerk/nextjs
npm i @clerk/nextjs@4.23.3-snapshot.87d921b
# @clerk/clerk-react
npm i @clerk/clerk-react@4.24.0-snapshot.87d921b
# @clerk/remix
npm i @clerk/remix@2.10.0-snapshot.87d921b
# @clerk/clerk-sdk-node
npm i @clerk/clerk-sdk-node@4.12.3-snapshot.87d921b
# @clerk/shared
npm i @clerk/shared@0.22.0-snapshot.87d921b
# @clerk/themes
npm i @clerk/themes@1.7.5
# @clerk/types
npm i @clerk/types@3.50.0-snapshot.87d921b

Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

Nice work 💯

Copy link
Member

@anagstef anagstef left a comment

Choose a reason for hiding this comment

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

💯

@jescalan jescalan force-pushed the brk.fix/expo-set-active-update-token branch 2 times, most recently from 991ef45 to 57c1b67 Compare August 25, 2023 20:54
@jescalan jescalan force-pushed the brk.fix/expo-set-active-update-token branch from 57c1b67 to ceb8bf9 Compare August 25, 2023 21:20
@jescalan jescalan merged commit 1663aaa into main Aug 25, 2023
8 checks passed
@jescalan jescalan deleted the brk.fix/expo-set-active-update-token branch August 25, 2023 21:36
@clerk-cookie clerk-cookie mentioned this pull request Aug 25, 2023
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 one.

packages/clerk-js/src/testUtils.ts Show resolved Hide resolved
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants