Hi, I'm not sure if this would be considered a bug or a documentation issue.
To create a custom id, we can explicitly declare an
field with type text or number (https://payloadcms.com/docs/fields/overview#customizable-id
). However, in my experience, this field also needs to be at the root of the collection's fields list. So, if the
field is declared within a row or collapsible, it no longer is recognized as a custom id field, and just a normal field that happen to be named
. In the DB, there will be a
field (the actual id), and
, just a normal text/number field.
I can understand the custom id cannot be within a group, a block, an array, or (named) tabs, as these fields can change the data structure in DB. However in the docs, the row and collapsible fields are said to be "presentational-only and only affects the Admin panel". The way I see it, either it is an intented behavior, in which case there could be a note about this herehttps://payloadcms.com/docs/fields/overview#customizable-id
, or it is not and I can open a bug report.
Custom id field is not recognized as such when placed inside of a row/collapsible
I think this should be possible, I can see in the code that custom id fields are not retrieved recursively. We just need to build a function to hoist fields out of rows/collapsibles/unnamed tabs. @jmikrut are you on board with this being an issue? Or would you like to limit it to a doc update?
i'd say this should be a feature request added to our roadmap
and we can update the docs in the meantime to call this out