From 325ebde0dcc2e887080d60d4a3e45124e437461c Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 11 Apr 2024 14:53:12 +0200 Subject: [PATCH] bin: Send global state update from pages --- bin/commands/inbox/select.rs | 2 ++ bin/commands/inbox/select/ui.rs | 1 + bin/commands/issue/select.rs | 4 ++-- bin/commands/issue/select/ui.rs | 2 +- bin/commands/patch/select.rs | 2 ++ bin/commands/patch/select/ui.rs | 1 + 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/commands/inbox/select.rs b/bin/commands/inbox/select.rs index fecb84e0..85943776 100644 --- a/bin/commands/inbox/select.rs +++ b/bin/commands/inbox/select.rs @@ -171,6 +171,7 @@ impl TryFrom<&Context> for State { pub enum Action { Exit { selection: Option }, + Update, PageSize(usize), OpenSearch, UpdateSearch { value: String }, @@ -222,6 +223,7 @@ impl store::State for State { self.ui.show_help = false; None } + Action::Update => None, } } } diff --git a/bin/commands/inbox/select/ui.rs b/bin/commands/inbox/select/ui.rs index 915f053e..81641fe0 100644 --- a/bin/commands/inbox/select/ui.rs +++ b/bin/commands/inbox/select/ui.rs @@ -125,6 +125,7 @@ impl<'a> Widget for ListPage<'a> { } } } + let _ = self.action_tx.send(Action::Update); } } diff --git a/bin/commands/issue/select.rs b/bin/commands/issue/select.rs index de7faf64..626e6c1f 100644 --- a/bin/commands/issue/select.rs +++ b/bin/commands/issue/select.rs @@ -92,7 +92,7 @@ impl TryFrom<&Context> for State { pub enum Action { Exit { selection: Option }, - SelectionChanged, + Update, PageSize(usize), OpenSearch, UpdateSearch { value: String }, @@ -142,7 +142,7 @@ impl store::State for State { self.ui.show_help = false; None } - Action::SelectionChanged => None, + Action::Update => None, } } } diff --git a/bin/commands/issue/select/ui.rs b/bin/commands/issue/select/ui.rs index 3c7e67e9..d49c181a 100644 --- a/bin/commands/issue/select/ui.rs +++ b/bin/commands/issue/select/ui.rs @@ -125,6 +125,7 @@ impl<'a> Widget for ListPage<'a> { } } } + let _ = self.action_tx.send(Action::Update); } } @@ -333,7 +334,6 @@ impl<'a> Widget for Issues<'a> { &mut self.table, key, ); - let _ = self.action_tx.send(Action::SelectionChanged); } } } diff --git a/bin/commands/patch/select.rs b/bin/commands/patch/select.rs index 0a804975..297ab640 100644 --- a/bin/commands/patch/select.rs +++ b/bin/commands/patch/select.rs @@ -92,6 +92,7 @@ impl TryFrom<&Context> for State { pub enum Action { Exit { selection: Option }, + Update, PageSize(usize), OpenSearch, UpdateSearch { value: String }, @@ -141,6 +142,7 @@ impl store::State for State { self.ui.show_help = false; None } + Action::Update => None, } } } diff --git a/bin/commands/patch/select/ui.rs b/bin/commands/patch/select/ui.rs index d2c189e6..3229b67a 100644 --- a/bin/commands/patch/select/ui.rs +++ b/bin/commands/patch/select/ui.rs @@ -128,6 +128,7 @@ impl<'a> Widget for ListPage<'a> { } } } + let _ = self.action_tx.send(Action::Update); } }