Skip to content

Commit aa2b28f

Browse files
axlewinjacbn
andauthored
Fix undefined value on controlled component
Co-authored-by: Jacob Brown <47645360+jacbn@users.noreply.github.com>
1 parent a3d043a commit aa2b28f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/app/components/content/IsaacCoordinateQuestion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const CoordinateInput = (props: CoordinateInputProps) => {
5858
type="text"
5959
className="force-print"
6060
placeholder={placeholderValues[i] ?? ""}
61-
value={value.coordinates ? value.coordinates[i] : ""}
61+
value={isDefined(value.coordinates?.[i]) ? value.coordinates[i] : ""}
6262
onChange={event => onChange({...value, coordinates: value.coordinates && value.coordinates.length ? value.coordinates.with(i, event.target.value) :
6363
(event.target.value === "" ? undefined : Array<string>(numberOfDimensions).fill("").with(i, event.target.value))})}
6464
readOnly={readonly}

0 commit comments

Comments
 (0)