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
This commit is contained in:
@@ -56,6 +56,8 @@ void SpaceHierarchyCache::populateSpaceHierarchy(const QString &spaceId)
|
||||
return;
|
||||
}
|
||||
auto job = m_connection->callApi<GetSpaceHierarchyJob>(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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user