feat: rewrite caching system, use onScroll instead of onEndReached#21
Merged
melvin-qte merged 15 commits intomainfrom Apr 30, 2025
Merged
feat: rewrite caching system, use onScroll instead of onEndReached#21melvin-qte merged 15 commits intomainfrom
melvin-qte merged 15 commits intomainfrom
Conversation
Collaborator
Author
|
TODO:
|
| } | ||
|
|
||
| const [files, sender] = await Promise.all([ | ||
| new Promise<FirebaseFirestore.DocumentData | undefined>( |
Member
There was a problem hiding this comment.
No need to create a new Promise anymore :D
noahsvensson
approved these changes
Apr 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ℹ️ Implementation details
Detail 1️⃣
This PR rewrites the caching system for messages.
🔴 Previously the subscriptions toward messages were setup the following way:
messageDocThis meant that if a new message was added, the whole cache would be reset by 1️⃣, meaning that no messages would be persisted. This could lead to behavior such as user being scrolled down or interrupted in their reading if anyone sent messages parallel to their activity.
🟢 Now the subscriptions toward messages are setup the following way:
messageDoc(previous messages)CuteChatintialization (only new messages)Now no caching is emptied, but only accordingly updated based on the snapshot event changes, meaning the list will persist, and minimize the disruption for the user.
Detail 2️⃣
In this PR we also switch from using the
onEndReachedproperty for out list view, to instead determining this ourselves via theonScrollproperty to disabled the list itself triggering a refetch without using input.