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

[5.x] Fix edit form errors after change of term slug #11056

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

Conversation

daun
Copy link
Contributor

@daun daun commented Nov 5, 2024

Updating a term slug currently results in two related issues:

  1. The browser url is now showing the old slug and results in a 404 on reload
  2. Submitting the form again results in a server error since the form will try and post to the old slug's update url

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.

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

Successfully merging this pull request may close these issues.

Updating term slug twice results in server error
1 participant