🐛 Fixes on load new messages

This commit is contained in:
LittleSheep 2025-03-01 22:52:22 +08:00
parent d043ef2410
commit 7bb73c80b0
2 changed files with 10 additions and 2 deletions

View File

@ -352,7 +352,13 @@ class ChatMessageController extends ChangeNotifier {
final countToFetch = math.min(resp.data['count'] as int, 100);
for (int idx = 0; idx < countToFetch; idx += kSingleBatchLoadLimit) {
await getMessages(kSingleBatchLoadLimit, idx, forceRemote: true);
final out = await getMessages(
kSingleBatchLoadLimit,
idx,
forceRemote: true,
);
messages.insertAll(0, out);
notifyListeners();
}
} catch (err) {
rethrow;

View File

@ -78,7 +78,9 @@ class WebSocketProvider extends ChangeNotifier {
} catch (err) {
if (err is WebSocketChannelException) {
logging.error(
'[WebSocket] Failed to connect to websocket...', err.inner);
'[WebSocket] Failed to connect to websocket...',
err.inner,
);
} else {
logging.error('[WebSocket] Failed to connect to websocket...', err);
}