mirror of
https://github.com/Rigellute/spotify-tui.git
synced 2026-04-25 23:55:53 +03:00
[PR #910] [MERGED] Fix confirmation dialog handling on playlist delete. #1086
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-tui#1086
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Rigellute/spotify-tui/pull/910
Author: @majabojarska
Created: 10/24/2021
Status: ✅ Merged
Merged: 11/17/2021
Merged by: @Rigellute
Base:
master← Head:fix_playlist_delete📝 Commits (2)
000c11dFix playlist deletion handling.9dda556Refactor get_current_user_saved_artists_next.📊 Changes
5 files changed (+14 additions, -12 deletions)
View changed files
📝
src/app.rs(+3 -7)📝
src/handlers/common_key_events.rs(+1 -0)📝
src/handlers/playlist.rs(+5 -3)📝
src/handlers/search_results.rs(+4 -2)📝
src/ui/mod.rs(+1 -0)📄 Description
Resolves #884.
Observations
I might not know the architecture of this application very well, but I believe I've narrowed down the root cause and drafted a quick solution. As of commit ecddb5e, the
push_navigation_stackmethod of theAppclass does not actually push any element to the navigation stack if the next route's id is the same as last route's id:That's the case when the uppercase
Dcharacter is entered, when a playlist is selected - the last route's id is the same as the next route's id (RouteId::Home):As a result, no new element is pushed to the navigation stack, hence the confirmation dialog window does not appear, and the playlist cannot be deleted.
Solution
My solution is to add a
RouteId::Dialog, which is specific to confirmation dialog windows. When a dialog is to be opened (e.g. when deleting a playlist), a new route (different than the current one) is pushed onto the navigation stack. Then, the logic responsible for drawing and handling user input in the confirmation dialog gets executed and works just fine.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.