Skip to content

Refactor clerkjs init#4709

Merged
nikosdouvlis merged 4 commits intomainfrom
nikos/global-fraud
Dec 9, 2024
Merged

Refactor clerkjs init#4709
nikosdouvlis merged 4 commits intomainfrom
nikos/global-fraud

Conversation

@nikosdouvlis
Copy link
Copy Markdown
Member

Description

Checklist

  • pnpm test runs as expected.
  • pnpm 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 Dec 4, 2024

🦋 Changeset detected

Latest commit: 6a3d41e

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 1:48pm

Comment thread packages/clerk-js/src/core/fraudProtection.ts
Comment thread packages/clerk-js/src/core/fraudProtection.ts
Comment thread packages/clerk-js/src/core/fraudProtection.ts
Comment thread packages/clerk-js/src/core/fraudProtection.ts
@nikosdouvlis nikosdouvlis force-pushed the nikos/global-fraud branch 2 times, most recently from c7bce11 to f0f9423 Compare December 5, 2024 00:41
Comment on lines +1855 to +1862
const initEnvironmentPromise = Environment.getInstance()
.fetch({ touch: shouldTouchEnv })
.then(res => {
this.updateEnvironment(res);
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we also make this a function and call it like we do with initClient()? It's a bit inconsistent now and a bit confusing to read.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No because we don't want to run two promises, we want to wait for the first one to resolve.


await Promise.all([initEnvironmentPromise, initClient()]).catch(async e => {
// limit the changes for this specific error for now
if (isClerkAPIResponseError(e) && e.errors[0].code === 'requires_captcha') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could be a util under @clerk/shared/error, as it is used in numerous places. We already have similar utils, like is4xxError etc.

@nikosdouvlis
Copy link
Copy Markdown
Member Author

!snapshot

@clerk-cookie
Copy link
Copy Markdown
Collaborator

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

Package Version
@clerk/astro 1.5.5-snapshot.v20241206140722
@clerk/backend 1.20.0-snapshot.v20241206140722
@clerk/chrome-extension 2.0.6-snapshot.v20241206140722
@clerk/clerk-js 5.40.0-snapshot.v20241206140722
@clerk/elements 0.21.1-snapshot.v20241206140722
@clerk/clerk-expo 2.4.2-snapshot.v20241206140722
@clerk/expo-passkeys 0.0.14-snapshot.v20241206140722
@clerk/express 1.3.23-snapshot.v20241206140722
@clerk/fastify 2.0.25-snapshot.v20241206140722
@clerk/localizations 3.8.0-snapshot.v20241206140722
@clerk/nextjs 6.8.0-snapshot.v20241206140722
@clerk/nuxt 0.0.10-snapshot.v20241206140722
@clerk/clerk-react 5.19.0-snapshot.v20241206140722
@clerk/remix 4.3.3-snapshot.v20241206140722
@clerk/clerk-sdk-node 5.0.74-snapshot.v20241206140722
@clerk/shared 2.19.1-snapshot.v20241206140722
@clerk/tanstack-start 0.6.3-snapshot.v20241206140722
@clerk/testing 1.3.35-snapshot.v20241206140722
@clerk/themes 2.1.53-snapshot.v20241206140722
@clerk/types 4.39.0-snapshot.v20241206140722
@clerk/ui 0.2.1-snapshot.v20241206140722
@clerk/vue 0.0.14-snapshot.v20241206140722

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

npm i @clerk/astro@1.5.5-snapshot.v20241206140722 --save-exact

@clerk/backend

npm i @clerk/backend@1.20.0-snapshot.v20241206140722 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@2.0.6-snapshot.v20241206140722 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.40.0-snapshot.v20241206140722 --save-exact

@clerk/elements

npm i @clerk/elements@0.21.1-snapshot.v20241206140722 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.4.2-snapshot.v20241206140722 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.0.14-snapshot.v20241206140722 --save-exact

@clerk/express

npm i @clerk/express@1.3.23-snapshot.v20241206140722 --save-exact

@clerk/fastify

npm i @clerk/fastify@2.0.25-snapshot.v20241206140722 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.8.0-snapshot.v20241206140722 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.8.0-snapshot.v20241206140722 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@0.0.10-snapshot.v20241206140722 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.19.0-snapshot.v20241206140722 --save-exact

@clerk/remix

npm i @clerk/remix@4.3.3-snapshot.v20241206140722 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.74-snapshot.v20241206140722 --save-exact

@clerk/shared

npm i @clerk/shared@2.19.1-snapshot.v20241206140722 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.6.3-snapshot.v20241206140722 --save-exact

@clerk/testing

npm i @clerk/testing@1.3.35-snapshot.v20241206140722 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.53-snapshot.v20241206140722 --save-exact

@clerk/types

npm i @clerk/types@4.39.0-snapshot.v20241206140722 --save-exact

@clerk/ui

npm i @clerk/ui@0.2.1-snapshot.v20241206140722 --save-exact

@clerk/vue

npm i @clerk/vue@0.0.14-snapshot.v20241206140722 --save-exact

@nikosdouvlis nikosdouvlis merged commit a574d58 into main Dec 9, 2024
@nikosdouvlis nikosdouvlis deleted the nikos/global-fraud branch December 9, 2024 08:12
wobsoriano pushed a commit that referenced this pull request Feb 8, 2025
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.

3 participants