🐛 Fixes on load new messages
This commit is contained in:
parent
d043ef2410
commit
7bb73c80b0
@ -352,7 +352,13 @@ class ChatMessageController extends ChangeNotifier {
|
|||||||
final countToFetch = math.min(resp.data['count'] as int, 100);
|
final countToFetch = math.min(resp.data['count'] as int, 100);
|
||||||
|
|
||||||
for (int idx = 0; idx < countToFetch; idx += kSingleBatchLoadLimit) {
|
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) {
|
} catch (err) {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
@ -78,7 +78,9 @@ class WebSocketProvider extends ChangeNotifier {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err is WebSocketChannelException) {
|
if (err is WebSocketChannelException) {
|
||||||
logging.error(
|
logging.error(
|
||||||
'[WebSocket] Failed to connect to websocket...', err.inner);
|
'[WebSocket] Failed to connect to websocket...',
|
||||||
|
err.inner,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
logging.error('[WebSocket] Failed to connect to websocket...', err);
|
logging.error('[WebSocket] Failed to connect to websocket...', err);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user