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

feat(clerk-js,shared): Add a navigateWithError utility for SignIn #2043

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

yourtallness
Copy link
Contributor

Description

WIP

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:

Packages affected

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

@yourtallness yourtallness requested a review from a team as a code owner November 3, 2023 21:48
Copy link

changeset-bot bot commented Nov 3, 2023

🦋 Changeset detected

Latest commit: 2b5c1a6

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

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

@yourtallness yourtallness marked this pull request as draft November 3, 2023 21:48
@@ -134,3 +135,8 @@ export function determineStartingSignInSecondFactor(secondFactors: SignInFactor[
const resetPasswordStrategies: SignInStrategy[] = ['reset_password_phone_code', 'reset_password_email_code'];
export const isResetPasswordStrategy = (strategy: SignInStrategy | string | null | undefined) =>
!!strategy && resetPasswordStrategies.includes(strategy as SignInStrategy);

export function navigateWithError(clerk: Clerk, navigate: (to: string) => Promise<unknown>, to: string, err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add this method as an internal method on Clerk Singleton. It feels like it's a better home with the current architecture.

@yourtallness yourtallness force-pushed the yourtallness/navigate_with_error branch from a6b4569 to ab672e7 Compare November 6, 2023 13:58
@yourtallness yourtallness marked this pull request as ready for review November 6, 2023 14:00
@yourtallness yourtallness force-pushed the yourtallness/navigate_with_error branch 2 times, most recently from 58b8c53 to 8409a28 Compare November 6, 2023 23:41
Copy link
Contributor

@desiprisg desiprisg left a comment

Choose a reason for hiding this comment

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

LGTM. Let's add a ticket to make a more uniform solution to these kind of problems, even if it gets backlogged for now.

@yourtallness yourtallness force-pushed the yourtallness/navigate_with_error branch from 8409a28 to 2b5c1a6 Compare November 7, 2023 12:28
@yourtallness yourtallness added this pull request to the merge queue Nov 7, 2023
@yourtallness
Copy link
Contributor Author

LGTM. Let's add a ticket to make a more uniform solution to these kind of problems, even if it gets backlogged for now.

https://linear.app/clerk/issue/SDK-914/determine-a-holistic-solution-for-redirecting-with-an-error

Merged via the queue into main with commit 0d1052a Nov 7, 2023
7 checks passed
@yourtallness yourtallness deleted the yourtallness/navigate_with_error branch November 7, 2023 12:44
yourtallness added a commit that referenced this pull request Nov 7, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 8, 2023
) (#2074)

* feat(clerk-js,shared): Add a navigateWithError utility for SignIn (#2043)

(cherry picked from commit 0d1052a)

* fix(clekr-js): Correctly return the reject return value

---------

Co-authored-by: Mark Pitsilos <mark.pitsilos@gmail.com>
Co-authored-by: Nikos Douvlis <nikosdouvlis@gmail.com>
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.

5 participants