Skip to content

Commit 73cc0c6

Browse files
committed
update cell value when value changes instead of onBlur
1 parent cbc3b63 commit 73cc0c6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/Widgets/EditableCell.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ export const EditableCell = ({
2222

2323
const [value, setValue] = React.useState(initialValue);
2424

25-
const onBlur = () => {
26-
updateCell(index, id, value);
27-
};
28-
2925
React.useEffect(() => {
3026
setValue(initialValue);
3127
}, [initialValue]);
28+
29+
React.useEffect(() => {
30+
updateCell(index, id, value);
31+
// eslint-disable-next-line react-hooks/exhaustive-deps
32+
}, [value]);
33+
3234
const { choices, defaultValue, isMulti } = fieldSchema;
3335
const intl = useIntl();
3436
const fieldType = getFieldType(fieldSchema, reactSelect);
@@ -40,7 +42,6 @@ export const EditableCell = ({
4042
{...fieldType.properties}
4143
value={getValue(fieldType.type, value, defaultValue, normalizedValue)}
4244
onChange={(...args) => onChangeFunction({ ...args, isMulti: isMulti })}
43-
onBlur={onBlur}
4445
/>
4546
) : (
4647
<span

0 commit comments

Comments
 (0)