From f0cf8298cbca63f0749aae1c3ed9eceabf243981 Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Sun, 15 Dec 2024 02:13:22 -0800 Subject: [PATCH] chore: lifted up UI state to handle elsewhere --- src/app/app.component.ts | 9 ++++----- src/app/views/home.component.ts | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index db87ee2..82452c3 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {Component, computed, effect} from '@angular/core'; +import {Component, effect, untracked} from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; import { injectDispatch, injectSelector } from "@reduxjs/angular-redux"; @@ -6,9 +6,6 @@ import {Event, listen} from '@tauri-apps/api/event'; import {setPosition, musicSync, Duration} from './store/tauri'; import { AppDispatch, RootState } from './store'; import { UnderTitlebar } from './components/under-titlebar.component'; -import {injectQuery} from "@tanstack/angular-query-experimental"; -import {invoke} from "@tauri-apps/api/core"; -import {SongMetadata} from "./types/song-metadata"; import {Metadata} from "./injectables/metadata"; @Component({ @@ -24,7 +21,9 @@ export class App { dispatch = injectDispatch(); _musicSync = effect((onCleanup) => { - this.dispatch(musicSync()); + // TODO: Without this, the effect is running over and over and over again despite not changing. IDK why. + // TODO: Debug this in Angular Redux + untracked(() => this.dispatch(musicSync())); // Listen for the server to tell us to sync the music player, like when the song changes or song is paused let unlisten = () => { }; diff --git a/src/app/views/home.component.ts b/src/app/views/home.component.ts index 2d4177e..59c6681 100644 --- a/src/app/views/home.component.ts +++ b/src/app/views/home.component.ts @@ -64,6 +64,7 @@ export class Home { return; } await play(path); + return true } })) -- 2.51.2