🐛 Fixes on load new messages
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user