@@ -360,6 +360,27 @@ document.addEventListener("DOMContentLoaded", () => {
360360
361361 const welcomeScreen = document . getElementById ( "welcome-screen" ) ;
362362
363+ // Get neuron select wrapper for loading spinner
364+ const neuronSelectWrapper = neuronSelect . closest ( ".selector" ) ;
365+
366+ // Helper functions for loading state
367+ const setLoadingState = ( isLoading ) => {
368+ // Disable all dropdowns
369+ const allSelects = document . querySelectorAll ( ".viewer-controls select" ) ;
370+ allSelects . forEach ( ( select ) => {
371+ select . disabled = isLoading ;
372+ } ) ;
373+
374+ // Show/hide spinner on neuron select
375+ if ( neuronSelectWrapper ) {
376+ if ( isLoading ) {
377+ neuronSelectWrapper . classList . add ( "is-loading" ) ;
378+ } else {
379+ neuronSelectWrapper . classList . remove ( "is-loading" ) ;
380+ }
381+ }
382+ } ;
383+
363384 const hidePreviewPane = ( ) => {
364385 frame . src = "about:blank" ;
365386 previewPane . classList . add ( "is-hidden" ) ;
@@ -484,6 +505,9 @@ document.addEventListener("DOMContentLoaded", () => {
484505 const selectedBase = matchingOption . value . trim ( ) ;
485506 const loadToken = ++ currentLoadToken ;
486507
508+ // Enable loading state
509+ setLoadingState ( true ) ;
510+
487511 fetchDatasetData ( selectedBase )
488512 . then ( ( data ) => {
489513 if ( loadToken !== currentLoadToken ) return ;
@@ -540,11 +564,25 @@ document.addEventListener("DOMContentLoaded", () => {
540564
541565 isRestoringFromURL = false ;
542566 updateURL ( ) ;
567+
568+ // Disable loading state after DOM updates complete
569+ requestAnimationFrame ( ( ) => {
570+ requestAnimationFrame ( ( ) => {
571+ setLoadingState ( false ) ;
572+ } ) ;
573+ } ) ;
543574 } )
544575 . catch ( ( error ) => {
545576 console . error ( error ) ;
546577 isRestoringFromURL = false ;
547578 updateURL ( ) ;
579+
580+ // Disable loading state after DOM updates complete
581+ requestAnimationFrame ( ( ) => {
582+ requestAnimationFrame ( ( ) => {
583+ setLoadingState ( false ) ;
584+ } ) ;
585+ } ) ;
548586 } ) ;
549587 } else {
550588 isRestoringFromURL = false ;
@@ -569,6 +607,9 @@ document.addEventListener("DOMContentLoaded", () => {
569607
570608 const loadToken = currentLoadToken ;
571609
610+ // Enable loading state
611+ setLoadingState ( true ) ;
612+
572613 fetchDatasetData ( selectedBase )
573614 . then ( ( data ) => {
574615 if ( loadToken !== currentLoadToken ) return ;
@@ -582,6 +623,13 @@ document.addEventListener("DOMContentLoaded", () => {
582623 state . neuronIndex = buildNeuronIndex ( state . neuronData ) ;
583624 populateNeuronOptions ( ) ;
584625 updateURL ( ) ;
626+
627+ // Disable loading state after DOM updates complete
628+ requestAnimationFrame ( ( ) => {
629+ requestAnimationFrame ( ( ) => {
630+ setLoadingState ( false ) ;
631+ } ) ;
632+ } ) ;
585633 } )
586634 . catch ( ( error ) => {
587635 console . error ( error ) ;
@@ -594,6 +642,13 @@ document.addEventListener("DOMContentLoaded", () => {
594642 hidePreviewPane ( ) ;
595643 checkIfBothViewersEmpty ( ) ;
596644 updateURL ( ) ;
645+
646+ // Disable loading state after DOM updates complete
647+ requestAnimationFrame ( ( ) => {
648+ requestAnimationFrame ( ( ) => {
649+ setLoadingState ( false ) ;
650+ } ) ;
651+ } ) ;
597652 } ) ;
598653 } ) ;
599654
0 commit comments