summary refs log tree commit diff
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r--src/ChatPage.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp

index 43455e86..0550c7f3 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -560,25 +560,26 @@ ChatPage::startInitialSync() } } - nhlog::net()->info("initial sync completed"); - - try { - cache::client()->saveState(res); + QTimer::singleShot(0, this, [this, res] { + nhlog::net()->info("initial sync completed"); + try { + cache::client()->saveState(res); - olm::handle_to_device_messages(res.to_device.events); + olm::handle_to_device_messages(res.to_device.events); - emit initializeViews(std::move(res)); - emit initializeMentions(cache::getTimelineMentions()); + emit initializeViews(std::move(res)); + emit initializeMentions(cache::getTimelineMentions()); - cache::calculateRoomReadStatus(); - } catch (const lmdb::error &e) { - nhlog::db()->error("failed to save state after initial sync: {}", e.what()); - startInitialSync(); - return; - } + cache::calculateRoomReadStatus(); + } catch (const lmdb::error &e) { + nhlog::db()->error("failed to save state after initial sync: {}", e.what()); + startInitialSync(); + return; + } - emit trySyncCb(); - emit contentLoaded(); + emit trySyncCb(); + emit contentLoaded(); + }); }); }