diff --git a/src/app/page.rs b/src/app/page.rs index 5d1efefd..f62b7040 100644 --- a/src/app/page.rs +++ b/src/app/page.rs @@ -197,15 +197,15 @@ impl ViewPage for HomeView { context: &Context, theme: &Theme, ) -> Result<()> { - let issue = context.issues().first().cloned(); - let patch = context.patches().first().cloned(); + // let issue = context.issues().first().cloned(); + // let patch = context.patches().first().cloned(); let navigation = widget::home::navigation(theme); let header = widget::common::app_header(context, theme, Some(navigation)).to_boxed(); let dashboard = widget::home::dashboard(context, theme).to_boxed(); - let issue_browser = widget::home::issues(context, theme, issue).to_boxed(); - let patch_browser = widget::home::patches(context, theme, patch).to_boxed(); + let issue_browser = widget::home::issues(context, theme, None).to_boxed(); + let patch_browser = widget::home::patches(context, theme, None).to_boxed(); app.remount(Cid::Home(HomeCid::Header), header, vec![])?; diff --git a/src/ui/widget/home.rs b/src/ui/widget/home.rs index 65b86dba..1ab637e5 100644 --- a/src/ui/widget/home.rs +++ b/src/ui/widget/home.rs @@ -77,8 +77,10 @@ impl IssueBrowser { items.sort_by(|a, b| b.timestamp().cmp(a.timestamp())); items.sort_by(|a, b| b.state().cmp(a.state())); - let selected = - selected.map(|(id, issue)| IssueItem::from((context.profile(), repo, id, issue))); + let selected = match selected { + Some((id, issue)) => Some(IssueItem::from((context.profile(), repo, id, issue))), + _ => items.first().cloned(), + }; let table = Widget::new(Table::new(&items, selected, header, widths, theme.clone())) .highlight(theme.colors.item_list_highlighted_bg); @@ -151,8 +153,12 @@ impl PatchBrowser { items.sort_by(|a, b| b.timestamp().cmp(a.timestamp())); items.sort_by(|a, b| a.state().cmp(b.state())); - let selected = selected - .map(|(id, patch)| PatchItem::try_from((context.profile(), repo, id, patch)).unwrap()); + let selected = match selected { + Some((id, patch)) => { + Some(PatchItem::try_from((context.profile(), repo, id, patch)).unwrap()) + } + _ => items.first().cloned(), + }; let table = Widget::new(Table::new(&items, selected, header, widths, theme.clone())) .highlight(theme.colors.item_list_highlighted_bg);