fix: defer visualizer, remote control, and last.fm to post-login

Visualizer FFT thread, remote control API server, and Last.fm session
restore were all initializing before user session activation, causing
errors ("No active session") and wasting resources.

Move all three to run after activate_user_session:
- Visualizer: add started guard to prevent double-start
- Remote control: sync_server now has per-user settings available
- Last.fm: restoreLastfmSession moved from bootstrapApp to handleLoginSuccess
This commit is contained in:
vicrodh committed 2026-02-06 09:27:09 -06:00
1 parent ff8c69f573
commit aef4285fd9
5 files changed
+32 -17

No files matched your search

+3 -12
View File
@@ -263,18 +263,9 @@ pub fn run() {
.media_controls
.init(app.handle().clone());
// Start visualizer FFT thread (disabled by default, enabled via command)
app.state::<AppState>()
.visualizer
.start(app.handle().clone());
// Start remote control API server if enabled
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
if let Err(e) = api_server::sync_server(&app_handle).await {
log::error!("Remote control API init failed: {}", e);
}
});
// NOTE: Visualizer FFT thread and Remote Control API server are started
// in activate_user_session (post-login), not here. They need per-user
// state to be initialized first.
// NOTE: Subscription purge check moved to activate_user_session
// (runs after login when per-user state is available)