From 5b0068d9e4bf142a81ca8d872d06c4ff47313e78 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 22 Feb 2024 22:34:47 +0100 Subject: [PATCH] Cache space hierarchy to disk This significantly improves the startup experiences by eliminating the changes in the space drawer while neochat loads. Implements #640 Replaces !1563 --- src/spacehierarchycache.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/spacehierarchycache.cpp b/src/spacehierarchycache.cpp index fec32a4b2..c24ab3a5b 100644 --- a/src/spacehierarchycache.cpp +++ b/src/spacehierarchycache.cpp @@ -56,6 +56,8 @@ void SpaceHierarchyCache::populateSpaceHierarchy(const QString &spaceId) return; } auto job = m_connection->callApi(spaceId); + auto group = KConfigGroup(KSharedConfig::openStateConfig("SpaceHierarchy"_ls), "Cache"_ls); + m_spaceHierarchy.insert(spaceId, group.readEntry(spaceId, QStringList())); connect(job, &BaseJob::success, this, [this, job, spaceId]() { const auto rooms = job->rooms(); @@ -67,6 +69,9 @@ void SpaceHierarchyCache::populateSpaceHierarchy(const QString &spaceId) } m_spaceHierarchy.insert(spaceId, roomList); Q_EMIT spaceHierarchyChanged(); + auto group = KConfigGroup(KSharedConfig::openStateConfig("SpaceHierarchy"_ls), "Cache"_ls); + group.writeEntry(spaceId, roomList); + group.sync(); }); }