Custom id field is not recognized as such when placed inside of a row/collapsible

default discord avatar
dr_mint11 months ago
2

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

id

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

id

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

id

. In the DB, there will be a

_id

field (the actual id), and

id

, 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 here

https://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

  • discord user avatar
    jarrod_not_jared
    11 months ago

    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?

  • discord user avatar
    jmikrut
    11 months ago

    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

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.