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.

Bulk edit not working on most of the fields, how to solve

default discord avatar
mvdve2 years ago
4

Hi All, when using the bulk edit feature in de admin ui, i am running in to an issue: On almost all fields the update fails with the message "Unable to update 1 out of 1 collection-name". There is no other message and there are no errors within the console.



What is the proper way to debug this, or is there some kind of limitation on bulk updates?



Would appreciate it if someone has a suggestion on this issue. Bit stuck on this one.

  • default discord avatar
    jessrynkar2 years ago

    Hi

    @557183523879124992

    , if you open the Network tab in your browser and try to make a bulk update, do you see a failed request?



    Another thought, on the collection you are trying to update, do you have update access set to true?


    access: {
      update: () => true,
    }
  • default discord avatar
    mvdve2 years ago

    Hi

    @854377910689202256

    thanks for the tips! Update is not set to true, that would be a bit of a security issue, i tested this but made no difference. I do see an error message in the json response of the failed request. The slug field should be invalid which is strange, because i can for example bulk edit the title, but not a category and editing this page via the normal way is always successful.



    Found it: When doing a bulk update, only that field is set. In my case, there is a validation hook on the slug which throws an error because the value is undefined, even when the field is required.

  • default discord avatar
    jessrynkar2 years ago

    Aaaah I see! Nice catch!

  • default discord avatar
    mvdve2 years ago

    For future reference: the types within the hooks are correct. They are for example string | undefined for the field hook and string[] | Category[] for a collection hook. The behavior between a single update and bulk update is different: With a single update, only the id's of a relationship are set and with a bulk update the full related collection item is returned so you have to do a bit of type checking when creating hooks. Something to keep in mind.

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.