Skip to content

Commit bf10ec0

Browse files
committed
fix: initialise reasonForChange default to empty string
The basic details form became dirty right after opening edit mode in react strict mode. This happened because reasonForChange started as undefined, but the textarea used an empty string. React Hook Form saw that as a change and marked the form dirty. Set reasonForChange default to empty string so the form starts clean and no false unsaved-changes warning appears.
1 parent c272739 commit bf10ec0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ui/src/components/stop-registry/stops/stop-details/basic-details/BasicDetailsSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const mapStopBasicDetailsDataToFormState = (stop: StopWithDetails) => {
2727
timingPlaceId: stop.quay?.timingPlaceId ?? stop.timing_place_id ?? null,
2828
stopState: stop.quay?.stopState ?? undefined,
2929
stopTypes: stop.quay?.stopType,
30+
reasonForChange: '',
3031
};
3132

3233
return formState;

0 commit comments

Comments
 (0)