Prevent redirecting to snippet view on error
What does this MR do?
Currently, in snippets, the GraphQL mutations for creating/updating snippet can fail in two ways:
- with a server error (like
500
, for example) - with the
errors
object in, otherwise, seemingly successful response
In both cases, we should stay on the same form and show the error message.
The first case is properly handled with catching the errors.
This MR addresses the second scenario when mutation is returned as successful but contains errors
Array with the more detailed/granular error messages. Right now, this scenario is broken: the browser gets reloaded losing any changes to the existing snippet.
Click-testing steps
- Enable
:snippets_edit_vue
feature flag in Rails console - Go to any existing snippet. Click "Edit"
- On the edit form for the snippet, type in the illegal File path for the snippet (
invalid://file/path
for example) - Click save
- The browser will be redirected to the snippet's view without saving the updated data
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
References #217727 (closed)
Edited by 🤖 GitLab Bot 🤖