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

Updating term slug creates duplicate instead of updating #10938

Open
daun opened this issue Oct 11, 2024 · 2 comments · May be fixed by #11058
Open

Updating term slug creates duplicate instead of updating #10938

daun opened this issue Oct 11, 2024 · 2 comments · May be fixed by #11058

Comments

@daun
Copy link
Contributor

daun commented Oct 11, 2024

Bug description

When the stache watcher is disabled, updating a term slug in the control panel creates a duplicate of the term instead of updating the term's slug. Looking at the content folder, the file is correctly renamed, but the control panel shows both the previous as well as the new version of the term.

There's a workaround — clearing the stache from an event listener after each term save — but that probably shouldn't be necessary. There's a related PR #9260 but since that marked the issue as solved, I figured this might be something else and opened a new issue.

With stache watcher disabled

Screen Recording 2024-10-11 at 13 16 55

With stache watcher enabled

Screen Recording 2024-10-11 at 13 19 31

How to reproduce

  • Disable stache watcher
  • Create a taxonomy
  • Create a term and save
  • Edit the term, update the slug, and save
  • Return to listing

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 10.48.22
PHP Version: 8.3.3
Composer Version: 2.5.1
Environment: local
Debug Mode: ENABLED
URL: statamic.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 1
Sites: 2 (DE, EN)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.30.0 PRO

Statamic Addons
daun/statamic-widget-collection-count: 1.2.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@joshuablum
Copy link
Member

Issue seems to be that $term->getOriginal('slug') returns null resulting in not deleting the old term because it thinks it's new.

@daun
Copy link
Contributor Author

daun commented Oct 14, 2024

Coincidentally, this seems to prevent the automatic update of term references in entries using that taxonomy.

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

Successfully merging a pull request may close this issue.

3 participants