Skip to content

Taxonomy Terms field shows wrong label when limited to single term #14785

Description

@efc

Bug description

If you add a taxonomy term field to a blueprint and limit it to a max of 1 term, then it will show the wrong label on dropdown and typeahead UI modes. It will show something like tags::bob instead of Bob.

How to reproduce

  1. Create a new taxonomy "Tags" associated with the collection "Pages."
  2. Add a taxonomy terms field to your Page blueprint if it was not created for you automatically.
  3. Make sure this field is limited to a max of 1 term and using the dropdown UI mode. Save the blueprint.
  4. Go to a Page entry and add the term "Bob" to your record. This will create a new term "Bob".
  5. Use Command-S to save your entry. Watch the term field. It will transform to "tags::bob".

Environment

Environment
Laravel Version: 13.6.0
PHP Version: 8.3.31
Composer Version: 2.9.5
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

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

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

Storage
public/storage: NOT LINKED

Statamic
Addons: 3
License Key: Not set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.18.0 PRO

Statamic Addons
tenseg/cascading-entry-protection: dev-main
tenseg/zone-date: dev-main
transformstudios/events: 6.0.1

Installation

Fresh statamic/statamic site via CLI

Additional details

This error can be fleeting when set up as described above. The system will display the label properly upon a reload of the entry. However, the following setup will never recover the correct label.

First complete the scenario above. Then...

  1. Create a collection "Stories".
  2. Add to the Story blueprint a grid, add to the grid a taxonomy term field that is limited to the "Tag" taxonomy and to a max of 1 term and using the dropdown UI mode, add to the grid a entries field to pick associated Page entries.
  3. Create a Story entry.
  4. Add a row to the grid and a new term to the taxonomy field by typing it out, let's say "Fred".
  5. Save your entry.
  6. Reload the Story entry's page.

When I go through this sequence, the label on the dropdown gets stuck as "tags::fred". This is a mistaken presentation that persists through reloads.

I cannot figure out why this happens, since the YAML for the tags and entries all looks good. It also only seems to occur when you are creating a new taxonomy entry from a dropdown or typeahead with a max of 1 term in a collection other than the one that was associated with the taxonomy. This is a very specific (but not unusual) case.

My workaround has been to use the stack UI, but I find that UI considerably more cumbersome and do wish I could rely on the dropdown instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions