Skip to content

Commit 58149ca

Browse files
committed
fix: Empty name should not match namePath check
1 parent 605bffe commit 58149ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Field.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ class Field extends React.Component<FieldProps, FieldState> implements FieldEnti
110110
public getNamePath = (): InternalNamePath => {
111111
const { name } = this.props;
112112
const { prefixName = [] }: InternalFormInstance = this.context;
113+
const namePath = getNamePath(name);
113114

114-
return [...prefixName, ...getNamePath(name)];
115+
return 'name' in this.props ? [...prefixName, ...namePath] : [];
115116
};
116117

117118
public getRules = (): RuleObject[] => {
@@ -356,7 +357,7 @@ class Field extends React.Component<FieldProps, FieldState> implements FieldEnti
356357
// Mark as touched
357358
this.touched = true;
358359

359-
let newValue;
360+
let newValue: StoreValue;
360361
if (getValueFromEvent) {
361362
newValue = getValueFromEvent(...args);
362363
} else {

0 commit comments

Comments
 (0)