From 66aecc8315121ab34087a013d6d1ae8dd9412e7b Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sat, 8 Aug 2026 23:15:48 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"gui:=20fix=20freeze=20on=20agent=20sw?= =?UTF-8?q?itch=20=E2=80=94=20bulk=20load=20chat=20blocks"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a3826f2ce896b0e40c0f4cb2013c277a5364d9b4. --- gui/chatblockmodel.cpp | 25 +++---------------------- gui/chatblockmodel.h | 3 --- gui/main.qml | 6 ------ 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/gui/chatblockmodel.cpp b/gui/chatblockmodel.cpp index 5f457e4..357bcc1 100644 --- a/gui/chatblockmodel.cpp +++ b/gui/chatblockmodel.cpp @@ -480,29 +480,10 @@ void ChatBlockModel::appendContent(const QString &line) last.content += '\n'; last.content += line; - if (!m_bulkLoading) { - rebuildBlockHtml(m_blocks.size() - 1); - QModelIndex idx = index(m_blocks.size() - 1); - emit dataChanged(idx, idx, {ContentRole, RenderedHtmlRole, SegmentsRole}); - } -} + rebuildBlockHtml(m_blocks.size() - 1); -void ChatBlockModel::beginBulkLoad() -{ - m_bulkLoading = true; -} - -void ChatBlockModel::endBulkLoad() -{ - m_bulkLoading = false; - // Rebuild HTML for all blocks once. - for (int i = 0; i < m_blocks.size(); ++i) { - rebuildBlockHtml(i); - } - if (!m_blocks.isEmpty()) { - emit dataChanged(index(0), index(m_blocks.size() - 1), - {ContentRole, RenderedHtmlRole, SegmentsRole}); - } + QModelIndex idx = index(m_blocks.size() - 1); + emit dataChanged(idx, idx, {ContentRole, RenderedHtmlRole, SegmentsRole}); } void ChatBlockModel::processLine(const QString &line) diff --git a/gui/chatblockmodel.h b/gui/chatblockmodel.h index b316406..cfb97ec 100644 --- a/gui/chatblockmodel.h +++ b/gui/chatblockmodel.h @@ -78,8 +78,6 @@ public: QHash roleNames() const override; Q_INVOKABLE void appendData(const QString &text); - Q_INVOKABLE void beginBulkLoad(); - Q_INVOKABLE void endBulkLoad(); Q_INVOKABLE void reset(); Q_INVOKABLE void trimFront(int keepCount); Q_INVOKABLE void clearDiagramCache(); @@ -112,7 +110,6 @@ private: QVariantList segmentsToVariant(const QList &segments) const; State m_state = State::BlockStart; - bool m_bulkLoading = false; KSyntaxHighlighting::Repository *m_repo = nullptr; QNetworkAccessManager *m_netManager = nullptr; diff --git a/gui/main.qml b/gui/main.qml index 9935cea..74b457a 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -463,10 +463,8 @@ ApplicationWindow { if (ollie.activeAgentId) { var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId) if (log) { - chatModel.beginBulkLoad() chatModel.appendData(log) chatModel.trimFront(20) - chatModel.endBulkLoad() } } ollie.refreshSessions() @@ -481,10 +479,8 @@ ApplicationWindow { if (ollie.activeSessionId && ollie.activeAgentId) { var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId) if (log) { - chatModel.beginBulkLoad() chatModel.appendData(log) chatModel.trimFront(20) - chatModel.endBulkLoad() } } } @@ -494,10 +490,8 @@ ApplicationWindow { if (ollie.activeSessionId && ollie.activeAgentId) { var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId) if (log) { - chatModel.beginBulkLoad() chatModel.appendData(log) chatModel.trimFront(20) - chatModel.endBulkLoad() } } }