diff --git a/CHANGELOG.md b/CHANGELOG.md index 105d758e..a36b25e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - [#577](https://github.com/estruyf/vscode-front-matter/issues/577): Fix in the `dataFile` field where data entries get overwritten - [#590](https://github.com/estruyf/vscode-front-matter/issues/590): Fix for image fields inside a sub-block - [#595](https://github.com/estruyf/vscode-front-matter/issues/595): Fix for media metadata now showing up +- [#596](https://github.com/estruyf/vscode-front-matter/issues/596): Fix for number field in block data ## [8.4.0] - 2023-04-03 - [Release notes](https://beta.frontmatter.codes/updates/v8.4.0) diff --git a/src/panelWebView/components/DataBlock/DataBlockField.tsx b/src/panelWebView/components/DataBlock/DataBlockField.tsx index 501aba81..7cbfeaea 100644 --- a/src/panelWebView/components/DataBlock/DataBlockField.tsx +++ b/src/panelWebView/components/DataBlock/DataBlockField.tsx @@ -333,7 +333,7 @@ export const DataBlockField: React.FunctionComponent = ({ ) : ( - )} diff --git a/src/panelWebView/components/Fields/NumberField.tsx b/src/panelWebView/components/Fields/NumberField.tsx index db814867..15f5c1d1 100644 --- a/src/panelWebView/components/Fields/NumberField.tsx +++ b/src/panelWebView/components/Fields/NumberField.tsx @@ -20,7 +20,7 @@ export const NumberField: React.FunctionComponent = ({ }: React.PropsWithChildren) => { const [nrValue, setNrValue] = React.useState(value); - const onValueChange = useCallback((txtValue: string) => { + const onValueChange = (txtValue: string) => { let newValue: number | null = options?.isDecimal ? parseFloat(txtValue) : parseInt(txtValue); if (isNaN(newValue)) { newValue = null; @@ -28,7 +28,7 @@ export const NumberField: React.FunctionComponent = ({ setNrValue(newValue); onChange(newValue); - }, [options?.isDecimal]); + }; const showRequiredState = useMemo(() => { return required && (nrValue === null || nrValue === undefined); diff --git a/src/panelWebView/components/Fields/TextField.tsx b/src/panelWebView/components/Fields/TextField.tsx index 35e7ee4d..04ade9c5 100644 --- a/src/panelWebView/components/Fields/TextField.tsx +++ b/src/panelWebView/components/Fields/TextField.tsx @@ -28,7 +28,7 @@ export const TextField: React.FunctionComponent = ({ onChange, required }: React.PropsWithChildren) => { - const [requiredFields, setRequiredFields] = useRecoilState(RequiredFieldsAtom); + const [, setRequiredFields] = useRecoilState(RequiredFieldsAtom); const [text, setText] = React.useState(value); const onTextChange = (txtValue: string) => { diff --git a/src/panelWebView/components/Fields/WrapperField.tsx b/src/panelWebView/components/Fields/WrapperField.tsx index 19ad9cc1..13f6a0a5 100644 --- a/src/panelWebView/components/Fields/WrapperField.tsx +++ b/src/panelWebView/components/Fields/WrapperField.tsx @@ -230,7 +230,6 @@ export const WrapperField: React.FunctionComponent = ({ return (