#Clearing hasMany text field with update

1 messages · Page 1 of 1 (latest)

lilac quail
#

Payload appears to ignore all possible instances of 'empty' when updating by id.
This makes it impossible to ever clear a hasMany text field once assigned.

{
  name: 'name',
  type: 'text',
  hasMany: true,
},
const results = await req.payload.update({
  req,
  collection: 'items',
  id: itemId,
  data: {
    name: [], // ignored
    name: null, // ignored
    name: undefined, // ignored
    name: new Array(), // ignored
    name: new Array<string>(), // ignored
    name: [''], // clears array but leaves single empty value
  },
});
spark nymphBOT
lilac quail
round juniper
#

I hope this will get a fix soon. This is something you'd expect to be tested 😄