|
| 1 | +--- |
| 2 | +id: TASK-308 |
| 3 | +title: Fix agent-created playlists not appearing in sidebar |
| 4 | +status: Done |
| 5 | +assignee: [] |
| 6 | +created_date: '2026-04-02 21:38' |
| 7 | +updated_date: '2026-04-02 21:42' |
| 8 | +labels: |
| 9 | + - bug |
| 10 | + - playlists |
| 11 | + - agent |
| 12 | + - frontend |
| 13 | + - tauri |
| 14 | +dependencies: [] |
| 15 | +references: |
| 16 | + - /Users/lance/git/mt/crates/mt-tauri/src/agent/mod.rs |
| 17 | + - /Users/lance/git/mt/app/frontend/js/components/genius-browser.js |
| 18 | + - /Users/lance/git/mt/app/frontend/js/components/sidebar.js |
| 19 | + - /Users/lance/git/mt/app/frontend/js/events.js |
| 20 | +priority: high |
| 21 | +--- |
| 22 | + |
| 23 | +## Description |
| 24 | + |
| 25 | +<!-- SECTION:DESCRIPTION:BEGIN --> |
| 26 | +Investigate and fix the refresh path so playlists created by the Genius/agent flow appear in the sidebar immediately after successful creation. Backend logs already show the playlist is created and persisted, so the task is to restore visibility and update propagation between the agent flow and playlist UI. |
| 27 | +<!-- SECTION:DESCRIPTION:END --> |
| 28 | + |
| 29 | +## Acceptance Criteria |
| 30 | +<!-- AC:BEGIN --> |
| 31 | +- [x] #1 A playlist created successfully through the Genius/agent flow appears in the sidebar without requiring an app restart. |
| 32 | +- [x] #2 Agent-created playlists trigger the same playlist update propagation path used by other playlist creation flows, or an equivalent path with matching observable behavior. |
| 33 | +- [x] #3 Automated test coverage reproduces the missing-refresh case and passes after the fix. |
| 34 | +<!-- AC:END --> |
| 35 | + |
| 36 | +## Implementation Notes |
| 37 | + |
| 38 | +<!-- SECTION:NOTES:BEGIN --> |
| 39 | +Root cause: the agent/Genius flow created playlists successfully, but the sidebar maintained its own playlist list and never subscribed to the local `mt:playlists-updated` browser event that Genius dispatches after success. The backend agent path also did not emit the standard Tauri `playlists:updated` event used by normal playlist CRUD commands. |
| 40 | +<!-- SECTION:NOTES:END --> |
| 41 | + |
| 42 | +## Final Summary |
| 43 | + |
| 44 | +<!-- SECTION:FINAL_SUMMARY:BEGIN --> |
| 45 | +Added a sidebar listener for `mt:playlists-updated` with cleanup in `destroy()`, so agent-created playlists now reload into the sidebar immediately. |
| 46 | + |
| 47 | +Added a frontend regression test proving the sidebar reloads playlists when `mt:playlists-updated` fires after init. |
| 48 | + |
| 49 | +Aligned the Rust agent playlist creation path with standard playlist behavior by emitting `PlaylistsUpdatedEvent::created` after successful agent playlist creation. |
| 50 | +<!-- SECTION:FINAL_SUMMARY:END --> |
0 commit comments