fix(angular): bottom loading indicator #304
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Previously the Angular SDK only displayed a loading indicator at the top of the message list (loading older messages).
However, the new virtualized message list removes DOM nodes when the user scrolls to the very top or bottom of the current message list, causing a short pause in the scrolling (the virtualized message list inside the Angular SDK is a simpler version than what you have in React, it doesn't track the height of each message, that's why it can only remove DOM nodes when the user reaches the very top/bottom of the currently displayed list).
This means that if the user scrolls up a lot, then down a lot, the virtualized list will change the displayed messages when the user scrolls to the bottom of the current message list, this happens very fast, but still, without a loading indicator the user might think that they reached the very end of the message list (when in fact they just reached the very end of the currently displayed items).
To solve this issue the Angular SDK displays a loading indicator at the bottom too. However this caused 2 issues, which this PR solves.
This PR only affects the Angular SDK.
🛠 Implementation details
Issue 1
If we display the loading indicator at the bottom, it messes up the scrollbar. See attached video
Screen.Recording.2024-07-22.at.13.41.16.mov
I'm not sure why this happen, but my guess: we animate the div that contains the loading indicator SVG, which is a full-width item, and when we rotate the item, it will create a "propeller" visualized by the following under:
Issue 2
I needed to add a "placeholder" loading indicator that is visible when the loading indicator itself is not, without it, the user might not notice that new messages appeared in the message list
🎨 UI Changes
Add relevant screenshots
Make sure to test with both Angular and React (with both
MessageList
andVirtualizedMessageList
components) SDKs