Skip to content

Commit 86dc879

Browse files
lnobrega-canarieLeonardo NobregaRuben van Leeuwen
authored
WrapFieldElement: differentiate between zero and undefined (#192)
* WrapFieldElement: differentiate between zero and undefined * allowZeroForInputNumber * 191: Uses _.isUndefined instead of zero check --------- Co-authored-by: Leonardo Nobrega <[email protected]> Co-authored-by: Ruben van Leeuwen <[email protected]>
1 parent 927bd4e commit 86dc879

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/packages/pydantic-forms/src/core/WrapFieldElement.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22
import { Controller, useFormContext } from 'react-hook-form';
33

4+
import _ from 'lodash';
5+
46
import { FieldWrap } from '@/components/fields';
57
import { useGetValidationErrors } from '@/core/hooks';
68
import {
@@ -58,7 +60,7 @@ export const WrapFieldElement = ({
5860
<PydanticFormControlledElement
5961
onChange={onChangeHandle}
6062
onBlur={onBlur}
61-
value={value || ''}
63+
value={!_.isUndefined(value) ? value : ''}
6264
disabled={!!pydanticFormField.attributes.disabled}
6365
name={name}
6466
pydanticFormField={pydanticFormField}

0 commit comments

Comments
 (0)