Skip to content

Commit 1229e32

Browse files
authored
chore: fix undefined (#3588)
* chore: fix undefined * chore: fix component robustness
1 parent 1959dec commit 1229e32

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/components/form/FormItem.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ const FormItem = forwardRef<FormItemInstance, FormItemProps>((originalProps, ref
172172

173173
if (formListName) {
174174
fieldName = [].concat(formListName, name);
175-
fieldValue = get(form.store, fieldName);
175+
fieldValue = get(form?.store, fieldName);
176176
}
177177

178178
fieldName = fieldName.filter((item) => item !== undefined);
179179

180-
if (!fieldName || !form) return;
180+
if (!fieldName) return;
181181
if (isEqual(fieldValue, newVal)) return;
182-
set(form.store, fieldName, newVal);
182+
set(form?.store, fieldName, newVal);
183183
setFormValue(newVal);
184184
};
185185

packages/components/select/base/Select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ const Select = forwardRefWithStatics(
283283
return (option?.label || '').toUpperCase().includes(upperValue);
284284
};
285285

286-
tmpPropOptions.forEach((option) => {
286+
tmpPropOptions?.forEach((option) => {
287287
if (option.group) {
288288
filteredOptions.push({
289289
...option,

0 commit comments

Comments
 (0)