Skip to content

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

Merged
merged 3 commits into from
Nov 13, 2024
Merged

fix: scroll to recent issues #2775

merged 3 commits into from
Nov 13, 2024

Conversation

isekovanic
Copy link
Contributor

🎯 Goal

This PR should resolve:

  • This GH issue (and all related to it)
  • This Zendesk ticket
  • Possibly any other issues related to scrolling to bottom after loading the first unread message

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@Stream-SDK-Bot
Copy link
Contributor

Stream-SDK-Bot commented Nov 11, 2024

SDK Size

title develop branch diff status
js_bundle_size 451 KB 451 KB 0 B 🟢

setLoadingMoreRecent(true);
channel.state.setIsUpToDate(true);
setHasNoMoreRecentMessagesToLoad(true);
channel.state.setIsUpToDate(shouldSetStateUpToDate);
Copy link
Contributor Author

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.

khushal87
khushal87 previously approved these changes Nov 12, 2024
setLoading(false);
},
() => {
channel?.state.setIsUpToDate(true);
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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]);
Copy link
Contributor Author

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.

@khushal87 khushal87 dismissed their stale review November 12, 2024 16:36

New changes added

@khushal87 khushal87 merged commit feea8ee into develop Nov 13, 2024
7 checks passed
@khushal87 khushal87 deleted the fix/scroll-to-recent-issues branch November 13, 2024 17:29
@github-actions github-actions bot mentioned this pull request Nov 14, 2024
6 tasks
@stream-ci-bot
Copy link
Contributor

🎉 This PR is included in version 5.42.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants