File tree 2 files changed +27
-7
lines changed
wormhole-connect/src/views/v2/Bridge/Routes
2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -282,22 +282,36 @@ const SingleRoute = (props: Props) => {
282
282
} , [ quote ] ) ;
283
283
284
284
const routeCardHeader = useMemo ( ( ) => {
285
- return typeof receiveAmount === 'undefined' ? (
286
- < CircularProgress size = { 18 } />
287
- ) : (
285
+ if ( props . error ) {
286
+ return < Typography color = "error" > Route is unavailable</ Typography > ;
287
+ }
288
+
289
+ if ( props . isFetchingQuote ) {
290
+ return < CircularProgress size = { 18 } /> ;
291
+ }
292
+
293
+ if ( receiveAmount === undefined ) {
294
+ return null ;
295
+ }
296
+
297
+ return (
288
298
< Typography >
289
299
{ receiveAmountTrunc } { destTokenConfig . symbol }
290
300
</ Typography >
291
301
) ;
292
302
} , [ destToken , receiveAmountTrunc ] ) ;
293
303
294
304
const routeCardSubHeader = useMemo ( ( ) => {
295
- if ( typeof receiveAmount === 'undefined' ) {
305
+ if ( props . error || ! destChain ) {
306
+ return null ;
307
+ }
308
+
309
+ if ( props . isFetchingQuote ) {
296
310
return < CircularProgress size = { 18 } /> ;
297
311
}
298
312
299
- if ( ! destChain ) {
300
- return < > </ > ;
313
+ if ( receiveAmount === undefined ) {
314
+ return null ;
301
315
}
302
316
303
317
const receiveAmountPrice = calculateUSDPrice (
Original file line number Diff line number Diff line change @@ -115,12 +115,18 @@ const Routes = ({ sortedSupportedRoutes, ...props }: Props) => {
115
115
const isSelected = routeConfig . name === props . selectedRoute ;
116
116
const quoteResult = quotesMap [ name ] ;
117
117
const quote = quoteResult ?. success ? quoteResult : undefined ;
118
+ // Default message added as precaution, as 'Error' type cannot be trusted
119
+ const quoteError =
120
+ quoteResult ?. success === false
121
+ ? quoteResult ?. error ?. message ??
122
+ `Error while getting a quote for ${ name } .`
123
+ : undefined ;
118
124
return (
119
125
< SingleRoute
120
126
key = { name }
121
127
route = { routeConfig }
122
128
available = { available }
123
- error = { availabilityError }
129
+ error = { availabilityError || quoteError }
124
130
isSelected = { isSelected }
125
131
onSelect = { props . onRouteChange }
126
132
quote = { quote }
You can’t perform that action at this time.
0 commit comments