fix(clerk-js): Clear feedback when undefined is passed to setError#2399
Conversation
We still have a lot of places in clerk-js where we call `setError(undefined)` instead of `clearFeedback`
🦋 Changeset detectedLatest commit: e5571d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
a721cc8 to
e5571d4
Compare
dimkl
left a comment
There was a problem hiding this comment.
❓ 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.
|
@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 |
|
@panteliselef let's proceed. |
Description
We still have a lot of places in clerk-js where we call
setError(undefined)instead ofclearFeedbackChecklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore