Skip to content

Commit

Permalink
fix(Form): fixed an issue when form-item is used out of form(Tencent#…
Browse files Browse the repository at this point in the history
  • Loading branch information
l123wx committed Nov 5, 2024
1 parent 291c790 commit be472b5
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 be472b5

Please sign in to comment.