From 1f9b65652dba66405235d60101cef60e3d8e6b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Tue, 25 Jun 2024 20:54:03 +0200 Subject: [PATCH] get channel->lastMessage from cache before hot-loading --- flutter/lib/pages/channel_list/channel_list_item.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flutter/lib/pages/channel_list/channel_list_item.dart b/flutter/lib/pages/channel_list/channel_list_item.dart index 1047167..8dff3de 100644 --- a/flutter/lib/pages/channel_list/channel_list_item.dart +++ b/flutter/lib/pages/channel_list/channel_list_item.dart @@ -7,6 +7,7 @@ import 'package:simplecloudnotifier/models/channel.dart'; import 'package:simplecloudnotifier/models/scn_message.dart'; import 'package:simplecloudnotifier/models/subscription.dart'; import 'package:simplecloudnotifier/state/app_auth.dart'; +import 'package:simplecloudnotifier/state/scn_data_cache.dart'; class ChannelListItem extends StatefulWidget { static final _dateFormat = DateFormat('yyyy-MM-dd kk:mm'); @@ -36,6 +37,8 @@ class _ChannelListItemState extends State { final acc = Provider.of(context, listen: false); if (acc.isAuth()) { + lastMessage = SCNDataCache().getMessagesSorted().where((p) => p.channelID == widget.channel.channelID).firstOrNull; + () async { final (_, channelMessages) = await APIClient.getMessageList(acc, '@start', pageSize: 1, channelIDs: [widget.channel.channelID]); setState(() {