Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): fix errors filter #3113

Merged
merged 3 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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