Skip to content
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

Unable to edit existing documents with custom ids as of beta 114 #8848

Closed
jeffreylouden opened this issue Oct 23, 2024 · 6 comments
Closed

Comments

@jeffreylouden
Copy link

Describe the Bug

As of beta 114, I'm no longer able to edit existing documents with a string IDs in the admin. Almost all of my project's collections use custom ids generated with nanoid -- the simple logic of which is included in the linked repository -- and I am able to successfully create new records with custom IDs, but all individual document pages in the admin present with a title of NaN and seems to trigger the create new collection route.

Image

Everything seems to work as expected in beta 113 or earlier (at least back until 80+).

Link to the code that reproduces this issue

https://github.com/jeffreylouden/payload-uneditable-collections

Reproduction Steps

  • Start the associated repository with a fresh database
  • Log into the admin panel and create a new item in the Test collection
  • The page should switch to editing the document, but display no information and display a title of 'NaN'

Which area(s) are affected? (Select all that apply)

db-postgres

Environment Info

payload: 3.0.0-beta.117
next: 15.0.0
@payloadcms/db-postgres: 3.0.0-beta.117
@payloadcms/email-nodemailer: 3.0.0-beta.117
@payloadcms/graphql: 3.0.0-beta.117
@payloadcms/next/utilities: 3.0.0-beta.117
@payloadcms/plugin-cloud: 3.0.0-beta.117
@payloadcms/richtext-lexical: 3.0.0-beta.117
@payloadcms/translations: 3.0.0-beta.117
@payloadcms/ui/shared: 3.0.0-beta.117
react: 19.0.0-rc-65a56d0e-20241020
react-dom: 19.0.0-rc-65a56d0e-20241020

@jeffreylouden jeffreylouden added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Oct 23, 2024
@rilrom
Copy link
Contributor

rilrom commented Oct 30, 2024

I believe you need to set idType to 'uuid' in postgresAdapter() to resolve this.

@d717an
Copy link

d717an commented Oct 30, 2024

we are also encountering this with SQLite which has no idtype option

@d717an
Copy link

d717an commented Oct 30, 2024

We're able to work around this issue by hashing our string id into a positive integer. Docs should be updated though if it's indeed not intended to be able to use text for ids.

@rilrom
Copy link
Contributor

rilrom commented Oct 30, 2024

we are also encountering this with SQLite which has no idtype option

Looking in the SQLite package code it does have an idType, the docs needs to be updated to reflect this.

@jeffreylouden
Copy link
Author

Thanks! setting idType in the postgresAdapter fixed things for me. I guess I missed this setting earlier in my upgrades and it was more strict in beta 114 and broke things for me. Closing this as fixed.

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 31, 2024
Copy link
Contributor

github-actions bot commented Nov 2, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants