[5.x] Fix edit form errors after change of term slug #11056
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.
Updating a term slug currently results in two related issues:
Fixed by comparing the response's
edit_url
value and the current url, and redirecting if they don't match. I was originally going for a more complicated solution of sending along the action urls with the JSON resource and updating it in the publish form, but there was too many edge cases to be worth it. Changing the slug won't happen too often, so the reload will probably not be a major nuisance.This might need some more thorough testing — there's a note on line 511 about needing to wait for save handlers in case the form was opened in a stack. Updating
window.location
might be too crude a solution then, and instead some other way of handling this could be necessary. Missing the context here, to be honest.Closes #11020.