Skip to content

Conversation

@dev-rb
Copy link
Contributor

@dev-rb dev-rb commented Dec 30, 2025

Summary

Solves an issue where on initial load of an email thread, the container would scroll to the top of the thread after a second or two.

This was caused by the EmailDebouncedReadMarker performing a mutation to mark the email as seen and that mutation invalidating the query of the email thread and triggering suspense. Adding a check for whether the email is actually unread prevents the unnecessary mutation for already read emails.

However, there were more issues with Suspense because of the places where query data was being read so this PR also refactors the implementation for email threads and cleans up some logic. In addition, email threads are now being displayed in reverse order — using flex-direction: 'column-reverse' on the container and toReversed on the data list — like channels so that the scroll position always start from the bottom and we can avoid some unnecessary jumping.

Other fixes/additions:

  • Fixed MarkdownTextarea calling props.onChange too eagerly when nothing had changed except the initial value being set
  • Adds query options to useThreadQuery to make it more flexible and overloads the function to fix the typing of the return result
  • Fixed an issue where the full html for an email was being shown when it wasn't actually the first in the thread, just the first in the visible list. This was causing the "quoted text" to show for no reason

Screenshots, GIFs, and Videos

First email in thread showing full html bug:
Screenshot 2025-12-30 at 4 39 55 PM

@linear
Copy link

linear bot commented Dec 30, 2025

@dev-rb dev-rb marked this pull request as ready for review December 30, 2025 21:37
@dev-rb dev-rb requested a review from a team as a code owner December 30, 2025 21:37
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.

2 participants