File tree Expand file tree Collapse file tree 1 file changed +1
-8
lines changed
packages/transition-frontend/src/components/forms/schedules Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Original file line number Diff line number Diff line change @@ -58,25 +58,18 @@ const TransitScheduleButton: React.FunctionComponent<ScheduleButtonProps> = (pro
5858 const serviceId = props . schedule . attributes . service_id ;
5959 const periodsGroups = Preferences . get ( 'transit.periods' ) ;
6060 const periodsGroupShortname = props . schedule . attributes . periods_group_shortname ;
61- // Add defensive check before accessing the template
61+ // Add defensive check before accessing the template, otherwise the interface breaks
6262 let periodsGroupName = '-' ;
6363 if ( periodsGroupShortname ) {
64- // Check if the template exists
6564 if ( periodsGroups [ periodsGroupShortname ] ) {
6665 periodsGroupName = periodsGroups [ periodsGroupShortname ] . name [ props . i18n . language ] ;
6766 } else {
68- // The template doesn't exist anymore, set it to default
6967 props . schedule . set ( 'periods_group_shortname' , 'default' ) ;
70-
71- // If we can save right away, do so (optional)
72- // Try to save the change silently
7368 try {
7469 props . schedule . save ( serviceLocator . socketEventManager ) ;
7570 } catch ( e ) {
7671 console . warn ( 'Could not save schedule with updated template' , e ) ;
7772 }
78-
79- // Use default template name if it exists
8073 if ( periodsGroups [ 'default' ] && periodsGroups [ 'default' ] . name ) {
8174 periodsGroupName = periodsGroups [ 'default' ] . name [ props . i18n . language ] ;
8275 }
You can’t perform that action at this time.
0 commit comments