Skip to content

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.

@jasonvarga jasonvarga merged commit d4f75c6 into statamic:5.x Oct 20, 2025
@daun daun deleted the fix/term-edit-url-after-slug-change branch November 4, 2025 11:29
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

2 participants