Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dedup any matching routes from nav stack
  • Loading branch information
cobbinma committed Jun 1, 2021
commit 3ebee74c3e23c2ea60841a7f2f54ec3e4c58238a
3 changes: 1 addition & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use std::{
use tui::layout::Rect;

use arboard::Clipboard;
use crate::app::RouteId::SelectedDevice;

pub const LIBRARY_OPTIONS: [&str; 6] = [
"Made For You",
Expand Down Expand Up @@ -635,7 +634,7 @@ impl App {
}

pub fn pop_navigation_stack(&mut self) -> Option<Route> {
self.navigation_stack.dedup_by_key(|x| x.id == SelectedDevice);
self.navigation_stack.dedup_by(|a, b| a.id == b.id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be just a bit nicer to do this in push_navigation_stack, assuming that that is the only place where the stack is stack is grown. In that case, it could possibly be just an if statement checking whether the current id is the same as the id at the top of the stack.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking at this 👍 moved to push_navigation_stack and changed to if statement.


if self.navigation_stack.len() == 1 {
None
Expand Down