Skip to content

Commit

Permalink
perf(next): improve mapStatus performance (#3183)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Jun 12, 2022
1 parent 66ffeb6 commit 46bdd46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/next/src/__builtins__/mapStatus.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { GeneralField } from '@formily/core'
import { Field } from '@formily/core'

export const mapStatus = (props: any, field: GeneralField) => {
export const mapStatus = (props: any, field: Field) => {
const takeStatus = () => {
if (!field) return
if (field['loading'] || field['validating']) return 'loading'
if (field['invalid']) return 'error'
if (field['warnings']?.length) return 'warning'
if (field.loading || field.validating) return 'loading'
if (field.selfErrors?.length) return 'error'
if (field.selfWarnings?.length) return 'warning'
return field.decoratorProps?.feedbackStatus
}
const takeState = (state: string) => {
Expand Down

0 comments on commit 46bdd46

Please sign in to comment.