Skip to content

Commit 7cd4150

Browse files
committed
fixup! front: editor-slopes-fix-form-validation
1 parent 6d46137 commit 7cd4150

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

front/src/applications/editor/components/LinearMetadata/FormComponent.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,17 @@ export const FormComponent: React.FC<FieldProps> = (props) => {
107107
}, [jsonSchema]);
108108

109109
const fixedData = useMemo(
110-
() => fixLinearMetadataItems(formData?.filter(notEmpty), distance, valueField ? {
111-
defaultValue: 0,
112-
fieldName: valueField
113-
} : undefined),
110+
() =>
111+
fixLinearMetadataItems(
112+
formData?.filter(notEmpty),
113+
distance,
114+
valueField
115+
? {
116+
defaultValue: 0,
117+
fieldName: valueField,
118+
}
119+
: undefined
120+
),
114121
[formData, distance]
115122
);
116123

front/src/applications/editor/components/LinearMetadata/tooltip.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { JSONSchema7 } from 'json-schema';
33
import { LinearMetadataItem } from 'common/IntervalsDataViz/types';
4+
import { isNil } from 'lodash';
45

56
interface LinearMetadataTooltipProps<T> {
67
item: LinearMetadataItem<T>;
@@ -38,7 +39,7 @@ export const LinearMetadataTooltip = <T extends Record<string, unknown>>({
3839
<span className="mr-3">
3940
{((schema.properties || {})[k] as JSONSchema7 | undefined)?.title || k}
4041
</span>
41-
{`${item[k] || '-'}`}
42+
{isNil(item[k]) ? '-' : `${item[k]}`}
4243
</div>
4344
))}
4445
</div>

0 commit comments

Comments
 (0)