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

Feedback modal: generic handle error #962

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KievDevel
Copy link
Contributor

@KievDevel KievDevel commented Jan 8, 2025

Generic error message (API does not respond / network error):

image

@greg-fer
Copy link
Contributor

greg-fer commented Jan 8, 2025

Maybe:

"Use the form below" > "Please write below how we can make this application better."

To narrow down the scope of the feedback we want (this app).

And:

"Send feedback" > "Send"

Copy link
Contributor

@boundlesscalm boundlesscalm left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +135 to +139
{errorMessage ? (
<p className="tw-mb-0 tw-mt-1 tw-text-right tw-text-xs tw-text-red">
{errorMessage}
</p>
) : null}
Copy link
Contributor

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.

Suggested change
{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>
)}

Copy link
Contributor Author

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

Copy link
Contributor

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:

Suggested change
{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.

@ketile
Copy link

ketile commented Jan 10, 2025

  • In addition to saying "an error occurred" we should state what the error is as best we can.
  • If "try again" does not solve the issue we should provide a link to support on DevZone.
  • Consider adding some text that explicitly states feedback will not be answered.

@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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. 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.
  2. True, but looks unnecessary for this use case, can be added later if needed?
  3. It is optional, doesn't break anything and most likely not needed for others, so I think no? Here I'm not sure

@KievDevel
Copy link
Contributor Author

@ketile did you mean this one?

  • Added a par. that feedback will not be answered.
  • Slightly updated an error message. Error most likely on user side like being offline. rare edge case would be that feedback server API does not work. In both cases we're unable to submit.
  • Used component from the quickstart
image

Copy link
Contributor

@greg-fer greg-fer left a 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.

@ketile
Copy link

ketile commented Jan 15, 2025

@KievDevel Looks great with latest changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants