Skip to content

Commit

Permalink
fix(core): fix errors filter (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored May 11, 2022
1 parent 604d74a commit 7d731af
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions packages/core/src/__tests__/field.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2188,3 +2188,22 @@ test('parent readPretty will overwrite self disabled or readOnly', () => {
expect(aa.pattern).toBe('readPretty')
expect(bb.pattern).toBe('editable')
})

test('conflict name for errors filter', async () => {
const form = attach(createForm<any>())
const aa = attach(
form.createField({
name: 'aa',
required: true,
})
)
const aa1 = attach(
form.createField({
name: 'aa1',
required: true,
})
)

await aa1.onInput('')
expect(aa.invalid).toBe(false)
})
2 changes: 1 addition & 1 deletion packages/core/src/shared/internals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ export const serialize = (model: any, getter?: any) => {
export const createChildrenFeedbackFilter = (field: Field) => {
const identifier = field.address?.toString()
return ({ address }: IFormFeedback) => {
return address.indexOf(identifier) === 0
return address === identifier || address.indexOf(identifier + '.') === 0
}
}

Expand Down

0 comments on commit 7d731af

Please sign in to comment.