-
Notifications
You must be signed in to change notification settings - Fork 332
fix: scroll to recent issues #2775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SDK Size
|
setLoadingMoreRecent(true); | ||
channel.state.setIsUpToDate(true); | ||
setHasNoMoreRecentMessagesToLoad(true); | ||
channel.state.setIsUpToDate(shouldSetStateUpToDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was mainly wrong. It would skip the last message set always.
setLoading(false); | ||
}, | ||
() => { | ||
channel?.state.setIsUpToDate(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these aren't separate as callbacks, channelQueryCallRef
is going to fire once more on the first overdrag at the bottom after we've scrolled. Nitpick, but still. :D
if (isNotLatestSet && hasNoMoreRecentMessagesToLoad) { | ||
loadChannelAroundMessage({}); | ||
} else if (!hasNoMoreRecentMessagesToLoad) { | ||
if (isNotLatestSet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just plain wrong at this point, hasNoMoreRecentMessagesToLoad
should never be true
when isNotLatestSet
is also true
(and yet it is, most likely set somewhere where we don't expect it). I have a guess that there's another bug lying around somewhere but at least the scroll-to behaviour should now work.
@@ -1207,6 +1207,7 @@ const ChannelWithContext = < | |||
await channel.query({}, 'latest'); | |||
} | |||
await channel.state.loadMessageIntoState('latest'); | |||
setMessages([...channel.state.messages]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever latestMessages
was very short (for example if we have 7-8 unread messages), the list was cut off since the state was not being set properly.
🎉 This PR is included in version 5.42.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎯 Goal
This PR should resolve:
🛠 Implementation details
🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
develop
branch