From 78938cb220aab880c44724536a190b6cd030541e Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:19:59 +0200 Subject: [PATCH] gui: fix chat not reloading on session switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The C++ connection mapping activeSessionIdChanged to chatModel->reset() raced against the QML onActiveSessionIdChanged handler which does the actual reload (reset → readLogForSession → appendData → trimFront). When the C++ slot fired after the QML handler, it cleared the freshly loaded chat data. Remove the redundant C++ connection — the QML handler owns the full reset+reload sequence and sequences the 9P log read correctly. --- gui/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/main.cpp b/gui/main.cpp index 96f0a15..517aa7c 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -28,9 +28,11 @@ int main(int argc, char *argv[]) auto *chatModel = new ChatBlockModel(&app); auto *theme = new ThemeManager(&app); - // Route chat stream to the block model + // Route chat stream to the block model. + // Reset + reload is handled in QML's onActiveSessionIdChanged so the + // readLogForSession 9P call is sequenced correctly; the C++ slot would + // fire before the QML handler and race against the log read. QObject::connect(ollie, &Ollie9pClient::chatReceived, chatModel, &ChatBlockModel::appendData); - QObject::connect(ollie, &Ollie9pClient::activeSessionIdChanged, chatModel, &ChatBlockModel::reset); engine.rootContext()->setContextProperty("ollie", ollie); engine.rootContext()->setContextProperty("chatModel", chatModel);