@@ -687,7 +687,31 @@ const getSectionSearchHaystack = (section) => section.nodes
687687 . join ( ' ' )
688688 . toLowerCase ( ) ;
689689
690- const isBasicWorkspaceSection = ( section ) => BASIC_WORKSPACE_SECTION_KEYS . has ( String ( section ?. key || '' ) ) ;
690+ const sectionContainsSelector = ( section , selector ) => {
691+ const nodes = Array . isArray ( section ?. nodes ) ? section . nodes : [ ] ;
692+ for ( const node of nodes ) {
693+ if ( ! ( node instanceof Element ) ) {
694+ continue ;
695+ }
696+ if ( typeof node . matches === 'function' && node . matches ( selector ) ) {
697+ return true ;
698+ }
699+ if ( typeof node . querySelector === 'function' && node . querySelector ( selector ) ) {
700+ return true ;
701+ }
702+ }
703+ return false ;
704+ } ;
705+
706+ const isBasicWorkspaceSection = ( section ) => {
707+ const key = String ( section ?. key || '' ) . trim ( ) . toLowerCase ( ) ;
708+ if ( BASIC_WORKSPACE_SECTION_KEYS . has ( key ) ) {
709+ return true ;
710+ }
711+ return sectionContainsSelector ( section , 'tbody#docker, tbody#vms' ) ;
712+ } ;
713+
714+ const getBasicWorkspaceSections = ( ) => settingsUiState . sections . filter ( ( section ) => isBasicWorkspaceSection ( section ) ) ;
691715
692716const getVisibleSections = ( ) => settingsUiState . sections . filter ( ( section ) => {
693717 const modeVisible = settingsUiState . mode === 'advanced'
@@ -811,6 +835,11 @@ const toggleAdvancedSectionByKey = (sectionKey) => {
811835
812836const applySettingsSectionVisibility = ( ) => {
813837 const visibleKeys = new Set ( getVisibleSections ( ) . map ( ( section ) => section . key ) ) ;
838+ if ( ! visibleKeys . size && settingsUiState . mode === 'basic' && ! settingsUiState . query ) {
839+ for ( const section of getBasicWorkspaceSections ( ) ) {
840+ visibleKeys . add ( section . key ) ;
841+ }
842+ }
814843 const forceExpandForQuery = Boolean ( settingsUiState . query ) ;
815844
816845 for ( const section of settingsUiState . sections ) {
@@ -6889,17 +6918,17 @@ const renderPerformanceDiagnostics = () => {
68896918const refreshType = async ( type ) => {
68906919 const startedAt = perfNowMs ( ) ;
68916920 const [ folders , prefs , info ] = await Promise . all ( [
6892- fetchFolders ( type ) ,
6893- fetchPrefs ( type ) ,
6921+ fetchFolders ( type ) . catch ( ( ) => ( { } ) ) ,
6922+ fetchPrefs ( type ) . catch ( ( ) => ( utils . normalizePrefs ( { } ) ) ) ,
68946923 fetchTypeInfo ( type ) . catch ( ( ) => ( { } ) )
68956924 ] ) ;
68966925
68976926 prefsByType [ type ] = utils . normalizePrefs ( prefs || { } ) ;
68986927 infoByType [ type ] = info && typeof info === 'object' ? info : { } ;
6899- setTypeFolders ( type , folders ) ;
6928+ setTypeFolders ( type , utils . normalizeFolderMap ( folders || { } ) ) ;
69006929 renderTable ( type ) ;
69016930 recordPerformanceDiagnosticsSample ( 'refresh' , type , perfNowMs ( ) - startedAt , {
6902- folderCount : Object . keys ( folders || { } ) . length ,
6931+ folderCount : Object . keys ( utils . normalizeFolderMap ( folders || { } ) ) . length ,
69036932 infoCount : Object . keys ( info || { } ) . length
69046933 } ) ;
69056934} ;
@@ -8814,7 +8843,13 @@ window.setSettingsMode = setSettingsMode;
88148843 initOverflowGuard ( ) ;
88158844 renderPerformanceDiagnostics ( ) ;
88168845 await fetchPluginVersion ( ) ;
8817- await refreshAll ( ) ;
8846+ try {
8847+ await refreshAll ( ) ;
8848+ } catch ( error ) {
8849+ // Keep initial settings sections visible on first-load API hiccups.
8850+ refreshSettingsUx ( ) ;
8851+ showError ( 'Initial data load failed' , error ) ;
8852+ }
88188853 const serverMode = getServerSettingsMode ( ) ;
88198854 if ( serverMode ) {
88208855 settingsUiState . mode = serverMode ;
@@ -8841,6 +8876,11 @@ window.setSettingsMode = setSettingsMode;
88418876 }
88428877 settingsUiState . initialized = true ;
88438878 } catch ( error ) {
8879+ try {
8880+ refreshSettingsUx ( ) ;
8881+ } catch ( _ignored ) {
8882+ // Best effort only; do not shadow the original initialization error.
8883+ }
88448884 showError ( 'Initialization failed' , error ) ;
88458885 }
88468886} ) ( ) ;
0 commit comments