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): Clear feedback when undefined is passed to setError #2399

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

panteliselef
Copy link
Member

Description

We still have a lot of places in clerk-js where we call setError(undefined) instead of clearFeedback

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

We still have a lot of places in clerk-js where we call `setError(undefined)` instead of `clearFeedback`
@panteliselef panteliselef self-assigned this Dec 19, 2023
Copy link

changeset-bot bot commented Dec 19, 2023

🦋 Changeset detected

Latest commit: e5571d4

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

Copy link
Contributor

@dimkl dimkl left a comment

Choose a reason for hiding this comment

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

❓ Searching for setError() in project i found that it's being called inside a promise catch() block in packages/clerk-js/src/ui/hooks/useFetch.ts. Is this intentional? Should we at least show a console.error?
I would suggest instead of calling setError() without args we could introduce a clear() method to unset the errors and the loading state or anything else related. By doing this, the intention of the action we want to do will be more clear.

@panteliselef
Copy link
Member Author

@dimkl I totally agree, this is my plan, but because this require a bit of refactoring and i don't want to mess too much with v4, shall we let this one be backported and make a new one with the proper refactoring ?

Btw you are referring to a different setError, this PR has to do with the one coming from useFormControl

@dimkl
Copy link
Contributor

dimkl commented Dec 19, 2023

@panteliselef let's proceed.

@panteliselef panteliselef added this pull request to the merge queue Dec 19, 2023
Merged via the queue into main with commit bf09d18 Dec 19, 2023
14 checks passed
@panteliselef panteliselef deleted the elef/sdk-1076-slug-with-error branch December 19, 2023 14:20
panteliselef added a commit that referenced this pull request Dec 19, 2023
#2399)

We still have a lot of places in clerk-js where we call `setError(undefined)` instead of `clearFeedback`

(cherry picked from commit bf09d18)
panteliselef added a commit that referenced this pull request Dec 19, 2023
#2399)

We still have a lot of places in clerk-js where we call `setError(undefined)` instead of `clearFeedback`

(cherry picked from commit bf09d18)
github-merge-queue bot pushed a commit that referenced this pull request Dec 19, 2023
#2399) (#2409)

We still have a lot of places in clerk-js where we call `setError(undefined)` instead of `clearFeedback`

(cherry picked from commit bf09d18)
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