From a17f73fd541e7d79db9475f22dc02efa372768ec Mon Sep 17 00:00:00 2001 From: filipriec Date: Fri, 29 Aug 2025 19:53:31 +0200 Subject: [PATCH] buffer bug fixed, now proper names are being displayed --- client/src/buffer/state.rs | 12 ++++++++---- client/src/ui/handlers/ui.rs | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/src/buffer/state.rs b/client/src/buffer/state.rs index 1ca0d90..dc311f4 100644 --- a/client/src/buffer/state.rs +++ b/client/src/buffer/state.rs @@ -31,10 +31,14 @@ impl AppView { /// Returns the display name with dynamic context (for Form buffers) pub fn display_name_with_context(&self, current_table_name: Option<&str>) -> String { match self { - AppView::Form(_) => { - current_table_name - .unwrap_or("Data Form") - .to_string() + AppView::Form(path) => { + // Derive table name from "profile/table" path + let table = path.split('/').nth(1).unwrap_or(""); + if !table.is_empty() { + table.to_string() + } else { + current_table_name.unwrap_or("Data Form").to_string() + } } _ => self.display_name().to_string(), } diff --git a/client/src/ui/handlers/ui.rs b/client/src/ui/handlers/ui.rs index 5d0a315..8cc36f4 100644 --- a/client/src/ui/handlers/ui.rs +++ b/client/src/ui/handlers/ui.rs @@ -445,9 +445,12 @@ pub async fn run_ui() -> Result<()> { AppView::AddTable => router.navigate(Page::AddTable(admin_state.add_table_state.clone())), AppView::AddLogic => router.navigate(Page::AddLogic(admin_state.add_logic_state.clone())), AppView::Form(path) => { - // Router now carries the path; just navigate with it + // Keep current_view_* consistent with the active buffer path if let Some((profile, table)) = path.split_once('/') { - app_state.set_current_view_table(profile.to_string(), table.to_string()); + app_state.set_current_view_table( + profile.to_string(), + table.to_string(), + ); } router.navigate(Page::Form(path.clone())); }