Skip to content

Commit

Permalink
fix(Form): fixed an issue when form-item is used out of form(#3182) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
l123wx authored Nov 6, 2024
1 parent 291c790 commit fc9fec8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/form/hooks/useFormItemInitialData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function useFormItemInitialData(name: FormItemProps['name']) {
children: FormItemProps['children'];
initialData: FormItemProps['initialData'];
}) {
if (name && !isEmpty(floatingFormDataRef.current)) {
if (name && floatingFormDataRef?.current && !isEmpty(floatingFormDataRef.current)) {
const nameList = formListName ? [formListName, name].flat() : name;
const defaultInitialData = get(floatingFormDataRef.current, nameList);
if (typeof defaultInitialData !== 'undefined') {
Expand Down

0 comments on commit fc9fec8

Please sign in to comment.