Add warning when user is about to delete condition with secondary skip #1752
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Trello card: https://trello.com/c/qcaW0Bv1/2107-add-a-warning-to-the-delete-route-page-that-shows-when-there-is-a-secondary-skip-route-for-the-same-question
Currently (when branching is enabled) deleting a skip route for a question that has a secondary skip route puts the form in a state where there is a route with an error that can’t be deleted.
We do want users to be able to delete individual routes for a question.
So we’ve agreed that we will delete the secondary skip for a question when deleting any other routes for that question. And we’ll let the user know before the delete a route, with a warning.
This PR does some refactoring and adds the warning; note that the deletion will take place in forms-api, see alphagov/forms-api#686.
Screenshots
Things to consider when reviewing