Skip to content

Commit a86aab9

Browse files
authored
early return if no help defined (#4816)
When `fieldPathId` is undefined, `helpId` will throw an undefined value error. The other `FieldHelpTemplate.tsx` files guard against this with an early return. Found this while trying the Mantine theme with a quickstart/simple string schema and it would not load the form because of this.
1 parent eb7e928 commit a86aab9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/mantine/src/templates/FieldHelpTemplate.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ export default function FieldHelpTemplate<
1212
>(props: FieldHelpProps<T, S, F>) {
1313
const { fieldPathId, help } = props;
1414

15+
if (!help) {
16+
return null;
17+
}
18+
1519
const id = helpId(fieldPathId);
1620

17-
return !help ? null : (
21+
return (
1822
<Text id={id} size='sm' my='xs' c='dimmed'>
1923
{help}
2024
</Text>

0 commit comments

Comments
 (0)