-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Custom IDs with type text doesn't work properly #12381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please add a reproduction in order for us to be able to investigate. Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided. Why was this issue marked with the
|
In the below video I attempted to recreate this but was unable to. I tested this with Postgres locally and with a neon DB as shown in the video. I am going to close this for now as we have test coverage in this area and I was unable to replicate. If you would like to re-open this or a new issue with more steps for reproduction, a repository we can clone down and a video showing what you are experiencing that might be better. Thanks! CleanShot.2025-05-27.at.13.08.01.mp4 |
Describe the Bug
I want to use ID as a text -> reason for this is that I have to (because of client) to use Nuxt as frontend and I wan to use Payload as the CMS. I thought that elegant solution would be to have collection Pages which has a ID of type text so I can just get the slug from Nuxt and query payload collection pages by this slug.
This is my collection config:
`import { CollectionConfig } from 'payload';
export const Pages: CollectionConfig = {
slug: 'pages',
admin: {
group: 'Content',
},
fields: [
{
type: 'text',
name: 'id',
required: true,
unique: true,
index: true,
},
],
};
`
Postgres I run fresh from docker.
Observed behavior is that I am in fact able to create the element and it is displayed in the list view with a correct ID. However after creation of an element in collection it shows NaN with a new form and when I click on the element in the ListView and edit it, it doesn't show anything and shows again NaN.
I am using latest payload (as of now v 3.37). It was recommended to me to change the idtype to UUID however this doesn't work either...
I checked with pgAdmin the table Pages and it contains entries with correct type.
Link to the code that reproduces this issue
Not really needed as creating env should be matter of a minute - one collection and in description
Reproduction Steps
Use Payload CMS with Posgress adapter and docker postgres latest.
Create new collection with field ID of type text.
Create a new element with id: test
Witness described behavior.
Which area(s) are affected? (Select all that apply)
area: ui
Environment Info
The text was updated successfully, but these errors were encountered: