kevinhughes27/ultimate-tournament

Error Banner Pattern

Opened this issue · 0 comments

Currently if a mutation was not successful the following happens:

If confirm is true then the message is used to display a confirmation dialog.

If the mutation errored or failed both these are handled the same way:

  1. We take the message (often just 'Create team failed' or similar. If there is no message we create a generic one, this happens for certain graphql errors that a user should never see)
  2. We try to render the errors onto the page permanently. This is done by trying to call the showErrors function which is defined if there is somewhere to put the errors on the page (the only implementation right now is the banner across the top of a form).
  3. If showErrors is not defined then showNotice (which is always defined) is used and the error is shown in a toast that dissappears.

There is a couple of things to dig into here for improvement:

  1. The error banner is ugly and I'm pretty sure that it can never actually show for it's intended use anymore. All form errors are field errors which get shown on the form

  2. Errors shown in notifications dissappear and it's possible the user hasn't read and understood them yet.

I'd like to confirm the above and then remove useless error messages and then if there is a message show a modal dialog. This would also make the confirm pattern a bit more normal. Basic errors show on the form, more advanced errors are on a dialog.