@@ -109,17 +109,49 @@ protected internal static void initializeStandardValues()
109109 {
110110 RunWithRuntimeActionBatch ( ( ) =>
111111 {
112+ setStatus ( "Initializing" ) ;
113+
112114 foreach ( var standardValue in StandardValues )
113115 {
114116 try
115117 {
116- LockManager . GetLock ( standardValue . Key , standardValue . Value ) ;
118+ // Wrap the standard value action to only execute if the underlying EDDI property has data
119+ // This prevents caching of null/empty values during early startup, allowing proper
120+ // initialization when monitors populate their data and PropertyChanged events fire
121+ LockManager . GetLock ( standardValue . Key , ( ) =>
122+ {
123+ // Determine if the property has data before executing the action
124+ var hasData = standardValue . Key switch
125+ {
126+ var k when k . Contains ( nameof ( EDDI . Instance . CurrentStarSystem ) ) => EDDI . Instance . CurrentStarSystem != null ,
127+ var k when k . Contains ( nameof ( EDDI . Instance . LastStarSystem ) ) => EDDI . Instance . LastStarSystem != null ,
128+ var k when k . Contains ( nameof ( EDDI . Instance . NextStarSystem ) ) => EDDI . Instance . NextStarSystem != null ,
129+ var k when k . Contains ( nameof ( EDDI . Instance . DestinationStarSystem ) ) => EDDI . Instance . DestinationStarSystem != null ,
130+ var k when k . Contains ( nameof ( EDDI . Instance . CurrentStellarBody ) ) => EDDI . Instance . CurrentStellarBody != null ,
131+ var k when k . Contains ( nameof ( EDDI . Instance . CurrentStation ) ) => EDDI . Instance . CurrentStation != null ,
132+ var k when k . Contains ( nameof ( EDDI . Instance . CurrentShip ) ) => EDDI . Instance . CurrentShip != null ,
133+ _ => true , // Other properties are assumed to always have data
134+ } ;
135+
136+ if ( hasData )
137+ {
138+ standardValue . Value ( ) ;
139+ }
140+ } ) ;
117141 }
118142 catch ( Exception ex )
119143 {
120144 Logging . Error ( $ "Failed to initialize { standardValue . Key } ", ex ) ;
121145 }
122146 }
147+
148+ // Initialize shipyard information
149+ var shipConfig = ConfigService . Instance . shipMonitorConfiguration ;
150+ if ( shipConfig ? . shipyard != null )
151+ {
152+ setShipyardValues ( shipConfig . shipyard . ToList ( ) ) ;
153+ }
154+
123155 RuntimeSetText ( "EDDI version" , Constants . EDDI_VERSION . ToString ( ) ) ;
124156 } ) ;
125157 }
@@ -327,8 +359,6 @@ protected static void setCommanderValues(Commander cmdr)
327359
328360 // Backwards-compatibility with 1.x
329361 RuntimeSetText ( "System rank" , cmdr ? . title ) ;
330-
331- setStatus ( "Operational" ) ;
332362 }
333363 catch ( Exception e )
334364 {
@@ -422,8 +452,6 @@ public static void setShipValues(Ship ship, string prefix)
422452 RuntimeSetText ( $ "{ prefix } station", ship . station ) ;
423453 RuntimeSetDecimal ( $ "{ prefix } distance", ship . distance ) ;
424454 }
425-
426- setStatus ( "Operational" ) ;
427455 }
428456 catch ( Exception e )
429457 {
0 commit comments