nova-issues icon indicating copy to clipboard operation
nova-issues copied to clipboard

Searchable BelongsTo field fetches all available resources when cleared by the user, partially defeating the purpose of being "searchable"

Open k8n opened this issue 7 months ago • 2 comments

  • Laravel Version: 11.11.0
  • Nova Version: 4.34.1
  • PHP Version: 8.3.1
  • Database Driver & Version: pgsql
  • Operating System and Version: Ubuntu 20
  • Browser type and version: Chrome 114+
  • Reproduction Repository: https://github.com/k8n/issues-6434-6454

Description:

See clearResourceSelection() of fields/Form/BelongsToField.vue. getAvailableResources() is called irrespective of whether the field isSearchable() (whereas initializeComponent() actually checks that condition first).

Detailed steps to reproduce the issue on a fresh Nova installation:

  • Setup a resource with a searchable BelongsTo field to another model
  • Create an instance of the model in Nova with the relationship set
  • Go to edit said resource
  • Clear the association (press the X within the field)
  • Watch Nova suck in representation of all relatable resources from the backend

k8n avatar Jul 08 '24 21:07 k8n