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

Typeahead field shows duplicate terms and corrupts data on save #11019

Closed
daun opened this issue Oct 27, 2024 · 0 comments · Fixed by #11059 or #11060
Closed

Typeahead field shows duplicate terms and corrupts data on save #11019

daun opened this issue Oct 27, 2024 · 0 comments · Fixed by #11059 or #11060

Comments

@daun
Copy link
Contributor

daun commented Oct 27, 2024

Bug description

I'm seeing an issue where the terms field shows terms twice, allows selecting both and will submit both, leading to possibly corrupt data when deleting one of the duplicates. This only seems to happen for the typeahead field.

The real issue seems to happen when selecting both of the duplicates, then removing one of them, and saving. The data is now indexed numerically, but skips an index. The term field refuses to show any data afterwards. See screenshots below.

The examples below are showing a terms field in select mode with three existing terms A, B, and C.

-
  handle: tags
  field:
    mode: select
    taxonomies:
      - tags
    type: terms
    display: Tags

Duplicate options

Screenshot 2024-10-27 at 23 14 25

Duplicate selection

Screenshot 2024-10-27 at 23 14 32

Duplicate submission payload

Screenshot 2024-10-27 at 23 14 53

Corrupt data when submitting with one duplicate deleted

Screenshot 2024-10-27 at 23 15 33

Broken input after submitting with one duplicate deleted

Screenshot 2024-10-27 at 23 15 27

How to reproduce

  • Install from cli
  • Create taxonomy tags
  • Add terms field to pages collection, limited to tags taxonomy, with typeahead input
  • Create new terms A, B, and C
  • Edit page from collection
  • Enter A into term field
  • A should appear twice, and should be selectable twice
  • Select and add both available A options
  • Select and add both available B options
  • Remove the first one of each
  • Save
  • Reload

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.29.0
PHP Version: 8.3.3
Composer Version: 2.5.1
Environment: local
Debug Mode: ENABLED
URL: statamic-terms-test.test
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

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.34.0 Solo

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

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