Skip to content

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

Merged
yourtallness merged 1 commit into
mainfrom
yourtallness/navigate_with_error
Nov 7, 2023
Merged

feat(clerk-js,shared): Add a navigateWithError utility for SignIn#2043
yourtallness merged 1 commit into
mainfrom
yourtallness/navigate_with_error

Conversation

@yourtallness

Copy link
Copy Markdown
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 ownerNovember 3, 2023 21:48
@changeset-bot

changeset-botBot commented Nov 3, 2023

Copy link
Copy Markdown

🦋 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
NameType
@clerk/clerk-jsMinor
@clerk/sharedMinor
@clerk/chrome-extensionPatch
@clerk/clerk-expoPatch
@clerk/backendPatch
@clerk/fastifyPatch
@clerk/nextjsPatch
@clerk/clerk-reactPatch
@clerk/remixPatch
@clerk/clerk-sdk-nodePatch
gatsby-plugin-clerkPatch

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
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
Copy Markdown
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
yourtallnessforce-pushed the yourtallness/navigate_with_error branch from a6b4569 to ab672e7CompareNovember 6, 2023 13:58
@yourtallness
yourtallness marked this pull request as ready for review November 6, 2023 14:00
@yourtallness
yourtallnessforce-pushed the yourtallness/navigate_with_error branch 2 times, most recently from 58b8c53 to 8409a28CompareNovember 6, 2023 23:41

@desiprisgdesiprisg left a comment

Copy link
Copy Markdown
Contributor

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
yourtallnessforce-pushed the yourtallness/navigate_with_error branch from 8409a28 to 2b5c1a6CompareNovember 7, 2023 12:28
@yourtallness
yourtallness added this pull request to the merge queue Nov 7, 2023
@yourtallness

Copy link
Copy Markdown
ContributorAuthor

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 0d1052aNov 7, 2023
@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-queueBot 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 freeto 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

@yourtallness@SokratisVidros@nikosdouvlis@desiprisg@clerk-cookie