payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.48k stars 1.55k forks source link

Same groups in ReactSelect for relationship fields #5245

Open dkirchhof opened 7 months ago

dkirchhof commented 7 months ago

Link to reproduction

No response

Describe the Bug

ReactSelect is used for relationship fields. It will be populated with OptionGroups. Unfortunately there are multiple groups with the same label.

For example I have a relation to a pages collection:

  1. There will be a group with a "pages" header and a single document (the selected one).
  2. There will be another group also with a "pages" header and 10 documents.
  3. I think after scrolling, the next lazy loaded pages (10 again) will be pushed to a new "pages" group.

image

To Reproduce

  1. Create a collection with a relationship field (relation to a single or multiple collections).
  2. Edit the collection and open the relation dropdown.

Payload Version

2.11.2

Adapters and Plugins

db-mongodb 1.4.2

dkirchhof commented 7 months ago

Probably it could be a feature. Don't know. A client asks to hide the headers of the groups completely if it is a relationship to a single collection.

mfilteau commented 3 months ago

I have the same issue. An additional category title is added when you add a new item to the select box.

image

When the select dropdown is filled initially, there is only one category title afterwards.

image