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

default discord avatar
tinouti
3 months 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

✅

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.