Skip to content

Commit

Permalink
fix(antd/next): fix form tab error badge count (#3206)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jun 17, 2022
1 parent a4974d2 commit 6eed89b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/antd/src/form-tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface IFormTabPaneProps extends TabPaneProps {
}

interface IFeedbackBadgeProps {
key: SchemaKey
name: SchemaKey
tab: React.ReactNode
}

Expand Down Expand Up @@ -60,7 +60,7 @@ const FeedbackBadge: ReactFC<IFeedbackBadgeProps> = observer((props) => {
const field = useField()
const errors = field.form.queryFeedbacks({
type: 'error',
address: `${field.address.concat(props.key)}.*`,
address: `${field.address.concat(props.name)}.*`,
})
if (errors.length) {
return (
Expand Down Expand Up @@ -105,7 +105,7 @@ export const FormTab: ComposedFormTab = observer(
<Tabs.TabPane
key={key}
{...props}
tab={<FeedbackBadge key={name} tab={props.tab} />}
tab={<FeedbackBadge name={name} tab={props.tab} />}
forceRender
>
<RecursionField schema={schema} name={name} />
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/form-tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface IFormTabPaneProps extends TabPaneProps {
}

interface IFeedbackBadgeProps {
key: SchemaKey
name: SchemaKey
tab: React.ReactNode
}

Expand Down Expand Up @@ -74,7 +74,7 @@ const FeedbackBadge: ReactFC<IFeedbackBadgeProps> = observer((props) => {
const field = useField()
const errors = field.form.queryFeedbacks({
type: 'error',
address: `${field.address.concat(props.key)}.*`,
address: `${field.address.concat(props.name)}.*`,
})
if (errors.length) {
return (
Expand Down Expand Up @@ -110,7 +110,7 @@ export const FormTab: ComposedFormTab = observer(
<Tabs.Item
key={key}
{...props}
tab={<FeedbackBadge key={name} tab={props.tab} />}
tab={<FeedbackBadge name={name} tab={props.tab} />}
>
<RecursionField schema={schema} name={name} />
</Tabs.Item>
Expand Down

0 comments on commit 6eed89b

Please sign in to comment.