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.

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

default discord avatar
.gustavocardosolast year
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
    last year

    hey

    @333046697062039553

    , 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
    .gustavocardosolast year

    This is my Posts collection



    This is the categories collection





    Thanks for your time!

  • discord user avatar
    tylandavis
    last year
    @333046697062039553

    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
    .gustavocardosolast year

    I'm using version 1.15.4

  • discord user avatar
    tylandavis
    last year

    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
    .gustavocardosolast year

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

  • discord user avatar
    tylandavis
    last year

    Glad I could help! cheers 🍻

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.