Problem when saving a post with categories - is this a bug?

default discord avatar
.gustavocardoso
2 months ago
7

Hello folks!



I have a collection of posts that have a collection of categories associated with it. When I select the category and click save, the post is saved successfully, but the selected category is not shown in the select. In order for me to see the category I need to reload the page. If I don't reload the page, make any changes to the post and save again I get an error: "The following field is invalid: category". Is this a bug or am I doing something wrong?



Thank you very much!



I just noticed that this problem only occurs when hasMany is set to true!!!

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    hey @.gustavocardoso, I tried to recreate your issue but am not seeing the same thing. There might be an issue with the way you have set it up. Can you share your Category collection config here so I can see if I spot any problems?

  • default discord avatar
    .gustavocardoso
    2 months ago

    This is my Posts collection



    This is the categories collection





    Thanks for your time!

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    @.gustavocardoso everything here looks correct to me. What version of Payload are you running? I know there have been a couple patch releases related to relationships, perhaps this issue was one of them

  • default discord avatar
    .gustavocardoso
    2 months ago

    I'm using version 1.15.4

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    This was indeed a bug, and was patched in 1.15.5. Upgrading to 1.15.5 or later will solve your issue 👍


    https://github.com/payloadcms/payload/releases/tag/v1.15.5
  • default discord avatar
    .gustavocardoso
    2 months ago

    Everithung is working fine now! Thank you bro. I owe you a beer! 😉

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    Glad I could help! cheers 🍻

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.