Skip to content

Commit 7d731af

Browse files
authored
fix(core): fix errors filter (#3113)
1 parent 604d74a commit 7d731af

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/core/src/__tests__/field.spec.ts

+19
Original file line numberDiff line numberDiff line change
@@ -2188,3 +2188,22 @@ test('parent readPretty will overwrite self disabled or readOnly', () => {
21882188
expect(aa.pattern).toBe('readPretty')
21892189
expect(bb.pattern).toBe('editable')
21902190
})
2191+
2192+
test('conflict name for errors filter', async () => {
2193+
const form = attach(createForm<any>())
2194+
const aa = attach(
2195+
form.createField({
2196+
name: 'aa',
2197+
required: true,
2198+
})
2199+
)
2200+
const aa1 = attach(
2201+
form.createField({
2202+
name: 'aa1',
2203+
required: true,
2204+
})
2205+
)
2206+
2207+
await aa1.onInput('')
2208+
expect(aa.invalid).toBe(false)
2209+
})

packages/core/src/shared/internals.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ export const serialize = (model: any, getter?: any) => {
656656
export const createChildrenFeedbackFilter = (field: Field) => {
657657
const identifier = field.address?.toString()
658658
return ({ address }: IFormFeedback) => {
659-
return address.indexOf(identifier) === 0
659+
return address === identifier || address.indexOf(identifier + '.') === 0
660660
}
661661
}
662662

0 commit comments

Comments
 (0)