@@ -250,7 +250,7 @@ export default function SessionsPage() {
250250 const where = watch ( 'where' ) ;
251251 const whereLanguage = watch ( 'whereLanguage' ) ;
252252 const sourceId = watch ( 'source' ) ;
253- const { data : sessionSource } = useSource ( {
253+ const { data : sessionSource , isPending : isSessionSourceLoading } = useSource ( {
254254 id : watch ( 'source' ) ,
255255 } ) ;
256256
@@ -480,31 +480,42 @@ export default function SessionsPage() {
480480 </ Group >
481481 </ Group >
482482 </ form >
483- { isSessionsLoading === false &&
484- ( sessionSource ?. kind !== SourceKind . Session || traceTrace == null ) ? (
485- < >
486- < Alert
487- icon = { < i className = "bi bi-info-circle-fill text-slate-400" /> }
488- color = "gray"
489- py = "xs"
490- mt = "md"
491- >
492- Please select a valid session source
493- </ Alert >
494- < SessionSetupInstructions />
495- </ >
496- ) : sessions . length === 0 && isSessionsLoading === false ? (
497- < SessionSetupInstructions />
498- ) : (
499- < div style = { { minHeight : 0 } } className = "mt-4" >
500- < SessionCardList
501- onClick = { session => {
502- setSelectedSession ( session ) ;
503- } }
504- sessions = { sessions }
505- isSessionLoading = { isSessionsLoading }
483+
484+ { isSessionsLoading || isSessionSourceLoading ? (
485+ < div className = "text-center mt-8" >
486+ < div
487+ className = "spinner-border me-2"
488+ role = "status"
489+ style = { { width : 14 , height : 14 } }
506490 />
491+ { isSessionSourceLoading ? 'Loading...' : 'Searching sessions...' }
507492 </ div >
493+ ) : (
494+ < >
495+ { sessionSource && sessionSource . kind !== SourceKind . Session && (
496+ < Alert
497+ icon = { < i className = "bi bi-info-circle-fill text-slate-400" /> }
498+ color = "gray"
499+ py = "xs"
500+ mt = "md"
501+ >
502+ Please select a valid session source
503+ </ Alert >
504+ ) }
505+ { ! sessions . length ? (
506+ < SessionSetupInstructions />
507+ ) : (
508+ < div style = { { minHeight : 0 } } className = "mt-4" >
509+ < SessionCardList
510+ onClick = { session => {
511+ setSelectedSession ( session ) ;
512+ } }
513+ sessions = { sessions }
514+ isSessionLoading = { isSessionsLoading }
515+ />
516+ </ div >
517+ ) }
518+ </ >
508519 ) }
509520 </ Box >
510521 </ div >
0 commit comments