Skip to content

Commit

Permalink
refactor(TripSeriesModal): clear state on close
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-cline committed Nov 6, 2023
1 parent 299353b commit 5802fca
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/editor/components/timetable/TripSeriesModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ const TripSeriesModal = (props: Props) => {
setAutoBlockIdStart(1)
setAutoBlockIdIncrement(1)
setAutoBlockIdPrefix('')
setUseAutoBlockIds(false)
setUseAutoTripIds(false)
}

const _onClose = () => {
const { onClose } = props
clearState()
onClose()
}

const onClickGenerate = useCallback(() => {
Expand Down Expand Up @@ -130,6 +138,7 @@ const TripSeriesModal = (props: Props) => {
placeholder={messages('prefixPlaceholder')}
style={{width: '30%', marginRight: '5px'}}
type='text'
value={autoTripIdPrefix}
/>
-
<FormControl
Expand Down Expand Up @@ -198,7 +207,7 @@ const TripSeriesModal = (props: Props) => {
{messages('generateTrips')}
</Button>
<Button
onClick={onClose}>
onClick={_onClose}>
{messages('close')}
</Button>
</Footer>
Expand Down

0 comments on commit 5802fca

Please sign in to comment.