Skip to content

Relationship fields are not searchable in the List View #10649

Open
@mfilteau

Description

@mfilteau

Describe the Bug

If we have a collection where a relationship field is identified as searchable:

export const Orders: CollectionConfig = {
  slug: 'orders',
  admin: {
    useAsTitle: 'orderNumber',
    listSearchableFields: ['customer'], // <--- field is relationship type
  },
  fields: [
    {
      name: 'orderNumber',
      type: 'text',
      required: true,
    },
    {
      name: 'date',
      type: 'date',
    },
    {
      name: 'product',
      type: 'relationship',
      relationTo: 'products',
    },
    {
      name: 'customer',
      type: 'relationship',
      relationTo: 'customers',
    },
  ],
}

The field appears to the user as searchable (in the list search placeholder) but nothing happens.

2025-01-17_15-46-03.mp4

Link to the code that reproduces this issue

https://github.com/mfilteau/payload-bugs

Reproduction Steps

  1. Seed the database

http://localhost:3000/api/seed

  1. Go to the Orders list view in admin panel

  2. See that the list should be searchable by Customer

  3. Try entering a customer name in the search box.

Nothing happens.

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 20.10.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.17.1
  next: 15.1.0
  @payloadcms/db-mongodb: 3.17.1
  @payloadcms/email-nodemailer: 3.17.1
  @payloadcms/graphql: 3.17.1
  @payloadcms/next/utilities: 3.17.1
  @payloadcms/payload-cloud: 3.17.1
  @payloadcms/richtext-lexical: 3.17.1
  @payloadcms/translations: 3.17.1
  @payloadcms/ui/shared: 3.17.1
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65457
  Available CPU cores: 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions