@@ -34,8 +34,8 @@ export class DustApp extends LitElement {
3434 @property ( { attribute : false } )
3535 appStateService ! : AppStateService ;
3636
37- @property ( { type : Object } )
38- appState ! : AppState ;
37+ @state ( )
38+ private appState ! : AppState ;
3939
4040 @state ( )
4141 private currentPage = "library" ;
@@ -46,7 +46,7 @@ export class DustApp extends LitElement {
4646 @state ( )
4747 private currentGenreId : number | null = null ;
4848
49- // Removed unused state variable
49+ private unsubscribe ?: ( ) => void ;
5050
5151 static styles = css `
5252 :host {
@@ -142,6 +142,15 @@ export class DustApp extends LitElement {
142142 connectedCallback ( ) {
143143 console . log ( "DustApp - connected callback" ) ;
144144 super . connectedCallback ( ) ;
145+
146+ // Initialize app state from service
147+ this . appState = this . appStateService . getState ( ) ;
148+
149+ // Subscribe to state changes
150+ this . unsubscribe = this . appStateService . subscribe ( ( ) => {
151+ this . appState = this . appStateService . getState ( ) ;
152+ } ) ;
153+
145154 window . addEventListener ( "popstate" , this . handleNavigation ) ;
146155 this . handleNavigation ( ) ;
147156
@@ -152,6 +161,7 @@ export class DustApp extends LitElement {
152161 disconnectedCallback ( ) {
153162 console . log ( "DustApp - disconnected callback" ) ;
154163 super . disconnectedCallback ( ) ;
164+ this . unsubscribe ?.( ) ;
155165 window . removeEventListener ( "popstate" , this . handleNavigation ) ;
156166 }
157167
0 commit comments