-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feedback modal: generic handle error #962
base: main
Are you sure you want to change the base?
Conversation
Maybe:
To narrow down the scope of the feedback we want (this app). And:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
{errorMessage ? ( | ||
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red"> | ||
{errorMessage} | ||
</p> | ||
) : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just me but I feel like a ternary expression makes this a bit harder to read.
{errorMessage ? ( | |
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red"> | |
{errorMessage} | |
</p> | |
) : null} | |
{!!errorMessage && ( | |
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red"> | |
{errorMessage} | |
</p> | |
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do this way because some engines can produce bugs because of expression rendering false / undefined.
Remix JS and React Native have this issue so I better be safe :) Our setup seems ok, but that's more as a new habit.
With the readability part I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Mias double negation, a simple negation and ||
should also work:
{errorMessage ? ( | |
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red"> | |
{errorMessage} | |
</p> | |
) : null} | |
{!errorMessage || ( | |
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red"> | |
{errorMessage} | |
</p> | |
)} |
(In my head I am reading this as “Either there is no error message or you output the error message”)
But I am fine with all three variants.
@boundlesscalm has made a error/warning component for the Quickstart application which I think would be a good fit for this use case. |
@@ -136,13 +149,18 @@ const FeedbackDialog = ({ | |||
const handleFormData = async ( | |||
feedback: string, | |||
setResponse: (response: boolean) => void, | |||
category?: string | |||
category?: string, | |||
onError?: () => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What is the purpose of this callback, is there already a plan to use it somewhere (for what?)?
- Would it be helpful to also pass the error to it?
- Should its addition be mentioned in the changelog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- currently there is no way to know that any error happened outside of the handleFormData(). I could throw error next and catch later where the hook is called, but this sounds unsafe if hook is used elsewhere.
- True, but looks unnecessary for this use case, can be added later if needed?
- It is optional, doesn't break anything and most likely not needed for others, so I think no? Here I'm not sure
@ketile did you mean this one?
![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove "Feedback will not be answered.".
- The feedback is by definition one way: "the transmission of evaluative or corrective information about an action, event, or process to the original or controlling source"
- The current phrasing of the sentence is direct and harsh.
- Including this message - which I haven't seen in any other feedback form elsewhere - can deter users from using this form.
@KievDevel Looks great with latest changes |
Generic error message (API does not respond / network error):