From 7db6564a0e64990809962952858d0e91565c0e49 Mon Sep 17 00:00:00 2001 From: DanS Date: Fri, 3 Jul 2026 23:24:52 -0500 Subject: [PATCH] feat(market): discard uncommitted group edits when switching away MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching to another group in the Manage-portfolio list (or adding/deleting a group) now discards the current group's uncommitted working edits instead of auto-saving them — only the Save button (and closing the modal) persists. This matches the explicit-save model signalled by the Revert/Save buttons and the unsaved-changes dot: navigating between drafts is ephemeral until saved. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui/windows/market_tab.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/windows/market_tab.cpp b/src/ui/windows/market_tab.cpp index 7a1fafa..ed70044 100644 --- a/src/ui/windows/market_tab.cpp +++ b/src/ui/windows/market_tab.cpp @@ -628,7 +628,7 @@ static void RenderPortfolioEditor(App* app) ImGui::PopID(); } if (delRow >= 0) { - commitIfNeeded(); // persist edits to the current group first + // Operates on the stored entries; any uncommitted working edits are discarded. auto es = settings->getPortfolioEntries(); if (delRow < (int)es.size()) { es.erase(es.begin() + delRow); @@ -638,13 +638,15 @@ static void RenderPortfolioEditor(App* app) else if (delRow == s_pf_sel) s_pf_sel = std::min(delRow, (int)es.size() - 1); PortfolioBeginEdit(app, s_pf_sel); } - } else if (clickedSel != -999) { commitIfNeeded(); PortfolioBeginEdit(app, clickedSel); } + } else if (clickedSel != -999) { + PortfolioBeginEdit(app, clickedSel); // switching groups discards uncommitted edits + } } ImGui::EndChild(); ImGui::Dummy(ImVec2(0, Layout::spacingSm())); // Add immediately creates a persisted "Untitled" group and selects it for editing. if (ImGui::Button(TR("portfolio_add_entry"), ImVec2(masterW, addH))) { - commitIfNeeded(); + // Adding switches to a new group; uncommitted edits to the current one are discarded. auto es = settings->getPortfolioEntries(); config::Settings::PortfolioEntry ne; ne.label = TR("portfolio_untitled");