Common best way to handle unread messages in private chats and forums
quoting from !257 (comment 72160):
I've played with it as well, and don't see any real difference either. Some things don't look optimal though: we're using
firstVisibleItemScrollOffset
as the key, which is dependent on aState
. If I'm not mistaken, this means that as soon as thescrollState
changes, the encapsulating composable (UnreadFabs
in this case) will be recomposed. Also, the callback insideremember
is called as soon as this key changes, which it will all the time during scrolling.I've compared your implementation with the one for private messages and it looks surprisingly different, using a
produceState
instead. Trying to adopt this here didn't lead to any improvements from what I could tell, so I would opt for leaving it as it was, also dropping thederivedStateOf
commit.We should however have a look at this again in the future and try to find a common way of handling unread messages for private chats and forums > new issue.