Fix edit set crashing on fresh installs

This commit is contained in:
Brandon Presley 2022-11-03 19:09:50 +13:00
parent 6f57b235d6
commit f52b1437f2
1 changed files with 3 additions and 3 deletions

View File

@ -21,14 +21,14 @@ export default function SetForm({
settings: Settings settings: Settings
}) { }) {
const [name, setName] = useState(set.name) const [name, setName] = useState(set.name)
const [reps, setReps] = useState(set.reps.toString()) const [reps, setReps] = useState(set.reps?.toString())
const [weight, setWeight] = useState(set.weight.toString()) const [weight, setWeight] = useState(set.weight?.toString())
const [newImage, setNewImage] = useState(set.image) const [newImage, setNewImage] = useState(set.image)
const [unit, setUnit] = useState(set.unit) const [unit, setUnit] = useState(set.unit)
const [showRemove, setShowRemove] = useState(false) const [showRemove, setShowRemove] = useState(false)
const [selection, setSelection] = useState({ const [selection, setSelection] = useState({
start: 0, start: 0,
end: set.reps.toString().length, end: set.reps?.toString().length,
}) })
const [removeImage, setRemoveImage] = useState(false) const [removeImage, setRemoveImage] = useState(false)
const weightRef = useRef<TextInput>(null) const weightRef = useRef<TextInput>(null)