Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

[Potential bug] global.update() with a non-localized relationship fields?

default discord avatar
tinouti2 years ago
1

Take the following global:


{
  slug: 'test',
  label: 'Test',
  fields: [
    {
      name: 'relationship',
      type: 'relationship',
      relationTo: 'regions',
      required: false,
      localized: false,
    },
    {
      name: 'description',
      type: 'textarea',
      required: true,
      localized: true,
    },
  ]
}


Through the admin, everything works fine. I can change locale, add/change the description field, and it saves no problem.



Now when I try to do the following

POST

request to the API

/api/globals/test?locale=fr

:


{
  "description": "Description en francais"
}

I get the following error:


{
  data: [...],
  message: "The following field is invalid: relationship"
  name: "ValidationError"
}


This looks like a bug to me, but wanted to check with y'all first to make sure I didn't miss something obvious. 🤔



Reproed it in the main repo, created a GitHub issue:

https://github.com/payloadcms/payload/issues/2766

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.