bug: app state update in progress not reflected in the UI during the connection recovery
Describe the bug
The Connection failure, reconnecting now... notification is displayed only during the time it takes the browser to emit the online event. However, the client may still need to perform few requests to retrieve fresh data. It may take longer to perform these requests
than the online status change. It leads to situations, when the app UI is updated unexpectedly (new messages added to the message list) - e.g unlocking the mobile screen after longer period of time.
To Reproduce
Steps to reproduce the behavior:
- Lock mobile screen with a chat app running in the browser
- Send new messages from another user's account to the active channel on the locked mobile device
- After few minutes unlock the mobile with the app and observe that the messages arrive longer after the
Connection failure, reconnecting now...flash message has disappeared
Expected behavior
The user should be provided with a visual clue signalling that the data retrieval is in place.
The connection.recovered event is emitted only if client.recoverStateOnReconnect is set to true. Therefore, this condition has to be checked before displaying the visual indicator for data loading after going online.
Package version
- stream-chat-react: 10.3.0
- stream-chat-js: 7.1.0