payload icon indicating copy to clipboard operation
payload copied to clipboard

Returning object from field condition causes it to be run infinitely

Open AlessioGr opened this issue 2 years ago • 1 comments

Describe the Bug

{
      type: 'text',
      name: 'textField',
      admin: {
        condition: (props) => {
          return {
            someObject: true
          }
        },
      },
 },

Having a field like this causes the condition function to endlessly run over and over again.

Yes, you are supposed to return a boolean, but I still find it weird that returning an object is causing this to happen.

This issue was found in #4410

Payload Version

2.5.0

AlessioGr avatar Dec 20 '23 20:12 AlessioGr

@patricsgamma I've created a new issue for #4410 if you're interested in following it

AlessioGr avatar Dec 20 '23 20:12 AlessioGr