buffer bug fixed, now proper names are being displayed

This commit is contained in:
filipriec
2025-08-29 19:53:31 +02:00
parent 2373ae4b8c
commit a17f73fd54
2 changed files with 13 additions and 6 deletions

View File

@@ -31,10 +31,14 @@ impl AppView {
/// Returns the display name with dynamic context (for Form buffers) /// Returns the display name with dynamic context (for Form buffers)
pub fn display_name_with_context(&self, current_table_name: Option<&str>) -> String { pub fn display_name_with_context(&self, current_table_name: Option<&str>) -> String {
match self { match self {
AppView::Form(_) => { AppView::Form(path) => {
current_table_name // Derive table name from "profile/table" path
.unwrap_or("Data Form") let table = path.split('/').nth(1).unwrap_or("");
.to_string() if !table.is_empty() {
table.to_string()
} else {
current_table_name.unwrap_or("Data Form").to_string()
}
} }
_ => self.display_name().to_string(), _ => self.display_name().to_string(),
} }

View File

@@ -445,9 +445,12 @@ pub async fn run_ui() -> Result<()> {
AppView::AddTable => router.navigate(Page::AddTable(admin_state.add_table_state.clone())), 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::AddLogic => router.navigate(Page::AddLogic(admin_state.add_logic_state.clone())),
AppView::Form(path) => { 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('/') { 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())); router.navigate(Page::Form(path.clone()));
} }