@@ -131,9 +131,11 @@ export default function FormSecondStepRT({
131131 control = { control }
132132 name = 'serviceAlerts'
133133 rules = { {
134- required : t ( 'form.feedLinkRequired' ) ,
135134 validate : async ( value ) => {
136- gtfsRtLinkValidation ( 'sa' ) ;
135+ const atLeastOneFeed = gtfsRtLinkValidation ( 'sa' ) ;
136+ if ( atLeastOneFeed !== true ) {
137+ return atLeastOneFeed ;
138+ }
137139 const exists = await checkFeedUrlExistsInCsv ( value ?? '' ) ;
138140 if ( typeof exists === 'string' && exists . length > 0 ) {
139141 return `Feed Exists:${ exists } ` ;
@@ -148,7 +150,7 @@ export default function FormSecondStepRT({
148150 error = { errors . serviceAlerts !== undefined }
149151 data-cy = 'serviceAlertFeed'
150152 helperText = {
151- errors . serviceAlerts ?. message === 'string' &&
153+ typeof errors . serviceAlerts ?. message === 'string' &&
152154 errors . serviceAlerts ?. message ?. startsWith (
153155 'Feed Exists:' ,
154156 ) ? (
@@ -223,9 +225,11 @@ export default function FormSecondStepRT({
223225 control = { control }
224226 name = 'tripUpdates'
225227 rules = { {
226- required : t ( 'form.feedLinkRequired' ) ,
227228 validate : async ( value ) => {
228- gtfsRtLinkValidation ( 'tu' ) ;
229+ const atLeastOneFeed = gtfsRtLinkValidation ( 'tu' ) ;
230+ if ( atLeastOneFeed !== true ) {
231+ return atLeastOneFeed ;
232+ }
229233 const exists = await checkFeedUrlExistsInCsv ( value ?? '' ) ;
230234 if ( typeof exists === 'string' && exists . length > 0 ) {
231235 return `Feed Exists:${ exists } ` ;
@@ -239,7 +243,7 @@ export default function FormSecondStepRT({
239243 { ...field }
240244 error = { errors . tripUpdates !== undefined }
241245 helperText = {
242- errors . tripUpdates ?. message === 'string' &&
246+ typeof errors . tripUpdates ?. message === 'string' &&
243247 errors . tripUpdates ?. message ?. startsWith (
244248 'Feed Exists:' ,
245249 ) ? (
@@ -314,9 +318,11 @@ export default function FormSecondStepRT({
314318 control = { control }
315319 name = 'vehiclePositions'
316320 rules = { {
317- required : t ( 'form.feedLinkRequired' ) ,
318321 validate : async ( value ) => {
319- gtfsRtLinkValidation ( 'vp' ) ;
322+ const atLeastOneFeed = gtfsRtLinkValidation ( 'vp' ) ;
323+ if ( atLeastOneFeed !== true ) {
324+ return atLeastOneFeed ;
325+ }
320326 const exists = await checkFeedUrlExistsInCsv ( value ?? '' ) ;
321327 if ( typeof exists === 'string' && exists . length > 0 ) {
322328 return `Feed Exists:${ exists } ` ;
@@ -330,7 +336,7 @@ export default function FormSecondStepRT({
330336 { ...field }
331337 error = { errors . vehiclePositions !== undefined }
332338 helperText = {
333- errors . vehiclePositions ?. message === 'string' &&
339+ typeof errors . vehiclePositions ?. message === 'string' &&
334340 errors . vehiclePositions ?. message ?. startsWith (
335341 'Feed Exists:' ,
336342 ) ? (
0 commit comments