Skip to content

TypeError in typeahead search: params.length check fails on object in SelectField.vue #13913

@jerwre

Description

@jerwre

Bug description

The terms fieldtype with mode: typeahead throws a JavaScript error when typing fast enough:
TypeError: can't access property "then", this.request(...) is undefined

This is due to resources/js/components/inputs/relationship/SelectField.vue, line 120:
if (!params.length && loaders.value[this.cacheKey]) return;

params is not an array with .length property

Fix:
Change !params.length to !Object.keys(params).length

How to reproduce

  1. Create a taxonomy field with mode: typeahead in a blueprint
  2. Edit an entry and mash some keys fast in the field and observe console

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.51.0
PHP Version: 8.3.27
Composer Version: 2.9.5
Environment: local
Debug Mode: ENABLED
URL: statamic-test.ddev.site
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: mariadb
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

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

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

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