Skip to content

Commit ee96c11

Browse files
committed
unpack hooks.validate arguments
1 parent e092249 commit ee96c11

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

examples/actions/schema.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ export const lists = {
4343
title: text(),
4444
content: text({
4545
hooks: {
46-
validate: args => {
47-
if (
48-
typeof args.resolvedFieldData === 'string' &&
49-
!args.resolvedFieldData.includes('good content')
50-
) {
51-
args.addValidationError('Content is not valid')
52-
}
46+
validate: ({ resolvedFieldData, addValidationError }) => {
47+
if (typeof resolvedFieldData !== 'string') return
48+
if (resolvedFieldData.includes('good content')) return
49+
addValidationError('Content is not valid')
5350
},
5451
},
5552
}),

0 commit comments

Comments
 (0)