mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 06:38:41 +08:00

Changing a tag name and reverting it to a previous tag name choice on the same screen (meaning, without reloading the page) causes a 404 error. Reproduction steps: * Open an existing tag page https://your-discourse.com/tag/a * Click the wrench, change the name and save * Open edit again, revert the name to the original tag name * 404 error This was happening because of the way we find existing objects in our store. Tags are using the name as the id/primary key unlike other records in the UI. When we get the existing object from the store we throw away the "new" ID, so we ended up with the old tag ID on the existing object, which led to a 404. To fix it we can just manually set the tag ID to what it is supposed to be from params in the tag show route. c.f. https://meta.discourse.org/t/404-error-when-you-revert-a-tag-name-after-changing-it-without-reloading-the-page/342559