Skip to content

field conditions run in bulk edit causing field to disapear #12846

@iofreddy85

Description

@iofreddy85

Describe the Bug

When using Edit in bulk in the list view, after selecting a field, sunch field doesn't show below to update.
After some digging and some console.logs, it seems if the field has a condition, when selecting the field for bulk edit, this condition is run...

The issue is that in bulk edit the condition is called and the data parameter receives only one key (the field being edited), with a default value. Then due to the logic of the condition, it returns false and the field is hidden in the bulk edit.

In reality the condition shouldn't even be called in edit bulk cause it's supposed to do logic with data related to 1 record either in the create, update, or view modes. But in a bulk edit scenario it doesn't make sense since we're trying to edit several records which each should run the condition logic and some may yield true and others false.

Link to the code that reproduces this issue

https://github.com/iofreddy85/payload/tree/edit-bulk-issue

Reproduction Steps

  1. Run the test environment in the branch code provided in the link of the issue.
  2. Go to the Products collection.
  3. Add 2 or more products (you can play with sotck control and add some with and some without)
  4. Go to the Products ListView, select all the Products and click Edit in the Top Right.
  5. Select Stock Waste field and see how it doesn't show.
  6. Check console.log on the condition and check how the data parameter comes with the field and a default value.

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: 3.43.0
NodeJs: 22.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions