8000 Custom IDs with type text doesn't work properly · Issue #12381 · payloadcms/payload · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
ondrejkouba opened this issue May 12, 2025 · 2 comments
Closed

Custom IDs with type text doesn't work properly #12381

ondrejkouba opened this issue May 12, 2025 · 2 comments

Comments

@ondrejkouba
Copy link

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

payload: 3.37.0
next: 15.3.0
node: 22.0.0
@ondrejkouba ondrejkouba added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels May 12, 2025
Copy link
Contributor

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 invalid-reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

Useful Resources

@github-actions github-actions bot removed the validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. label 8568 May 12, 2025
@JarrodMFlesch
Copy link
Contributor

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

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0