Fix confirmation dialog handling on playlist delete. #910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_stack
method of theApp
class 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
D
character 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.