Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): fix stuck cover-upload flag + library-picker stale selection

[._.]/ Adam Eivyd19b5220361f
diff --git a/client/src/components/music/AlbumsManager.jsx b/client/src/components/music/AlbumsManager.jsx
index 8386ad3f65..30a0175fff 100644
--- a/client/src/components/music/AlbumsManager.jsx
+++ b/client/src/components/music/AlbumsManager.jsx
@@ -164,8 +164,10 @@ export default function AlbumsManager() {
const base64 = await readFileAsBase64(file).catch(() => null);
if (!base64) { setUploadingCover(false); toast.error('Could not read that file'); return; }
const uploaded = await uploadGalleryImage(base64, { silent: true }).catch((err) => { toast.error(err.message || 'Upload failed'); return null; });
- if (genRequestRef.current !== requestId) return; // album switched mid-upload — drop
+ // Always clear the in-flight flag (even on a stale result) so a mid-upload
+ // album switch doesn't leave the new album's Upload/Generate stuck disabled.
setUploadingCover(false);
+ if (genRequestRef.current !== requestId) return; // album switched mid-upload — don't write the form
if (uploaded?.path) { setCover(uploaded.path); toast.success('Cover uploaded'); }
};
diff --git a/client/src/components/music/TracksManager.jsx b/client/src/components/music/TracksManager.jsx
index 422c4f501d..6847523368 100644
--- a/client/src/components/music/TracksManager.jsx
+++ b/client/src/components/music/TracksManager.jsx
@@ -172,14 +172,21 @@ export default function TracksManager() {
const openLibrary = async () => {
if (!requireSaved()) return;
+ const targetId = persisted.id;
const res = await listMusicLibrary({ silent: true }).catch(() => null);
+ // The user may have switched tracks (or to a new unsaved one) while the
+ // library list loaded — don't pop the picker open for a stale selection.
+ if (selectedIdRef.current !== targetId) return;
setLibrary(Array.isArray(res?.tracks) ? res.tracks : []);
setLibraryOpen(true);
};
const attachFromLibrary = async (filename) => {
setLibraryOpen(false);
- const targetId = persisted.id;
+ // Re-resolve the target from the live selection rather than a possibly-stale
+ // `persisted` — and bail if there's no saved track to attach to.
+ const targetId = selectedIdRef.current;
+ if (!targetId || targetId === 'new') { toast.error('Save the track first, then add audio'); return; }
const res = await attachTrackAudio(targetId, filename, { silent: true }).catch((err) => { toast.error(err.message || 'Attach failed'); return null; });
if (res?.track) {
upsertLocal(res.track);