Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
If you add localized: true to the title field in the posts collection, everything works fine because the type is string, which matches the type in payload-types.ts.
However, if you omit localized: true or set it to false, payload-types.ts still sets it to string, but src/components/Card/index.tsx gets { [locale]: string } and that's why when you try to render {titleToUse} in that file you get this error:
Which area(s) are affected? (Select all that apply)
The problem was that I set localized: true, translated the field, and then set localized: false again, so the data was corrupted. Restarting the DB fixed it.
Describe the Bug
Explained in reproduction steps.
Maybe it's related to the other bug we were talking about localization interfering with searchPlugin @paulpopus?
Link to the code that reproduces this issue
https://github.com/payloadcms/enterprise-demo/tree/localized-type-bug
Reproduction Steps
The repository is based on the website template but localization is added:
If you add
localized: true
to thetitle
field in theposts
collection, everything works fine because the type isstring
, which matches the type inpayload-types.ts
.However, if you omit
localized: true
or set it to false,payload-types.ts
still sets it tostring
, butsrc/components/Card/index.tsx
gets{ [locale]: string }
and that's why when you try to render{titleToUse}
in that file you get this error:Which area(s) are affected? (Select all that apply)
area: core, area: templates
Environment Info
Payload: beta.114