Skip to content

Commit

Permalink
Pass missing onChangeBlock to BlockForm
Browse files Browse the repository at this point in the history
- also simplify dependency aray of value change checking only the value
  • Loading branch information
ichim-david committed Jun 25, 2024
1 parent 71e959e commit 951a015
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/DescriptionBlock/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const DescriptionBlockEdit = (props) => {
} = props;
const { slate } = config.settings;
const intl = useIntl();
const initialValue = data?.value || config.settings.slate.defaultValue();
const initialValue = data?.value || slate.defaultValue();
const [value, setValue] = useState(initialValue);
const text = metadata?.['description'] || properties?.['description'] || '';
const withBlockProperties = useCallback(
Expand Down Expand Up @@ -71,7 +71,9 @@ export const DescriptionBlockEdit = (props) => {
if (data.value !== value) {
onChangeBlock(block, { ...data, value: value });
}
}, [block, data, onChangeBlock, value]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data.value, value]);

const handleFocus = useCallback(() => {
if (!selected) {
onSelectBlock(block);
Expand Down Expand Up @@ -101,6 +103,7 @@ export const DescriptionBlockEdit = (props) => {
<BlockDataForm
schema={schema}
title={schema.title}
onChangeBlock={onChangeBlock}
onChangeField={(id, newValue) => {
props.onChangeBlock(props.block, {
...props.data,
Expand Down

0 comments on commit 951a015

Please sign in to comment.