-
Notifications
You must be signed in to change notification settings - Fork 32
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
Implementation can cause major inconsistencies and missed messages #505
Comments
Thank you for the detailed bug report. I have a fix in mind, which I still have to validate. If that works, you can expect a release with the fix sometime next week. I'll keep you posted either case. |
Just a clarification: your issue description mentions About the first problem, which is that the SDK sets About the second problem, which is that |
Hi Zita,
Thanks for looking into this. We are no longer using Stream Chat so if
you feel so inclined you can close this ticket.
Nick
…On 22 Nov 2023, at 4:38, Zita Szupera wrote:
Just a clarification: your issue description mentions `has_unread`
*filter*, but we don't have such filter, `has_unread` is a *sort*
parameter.
About the first problem, which is that the SDK sets `offset`
incorrectly because it counts channels from WS events as well: this is
fixed in
***@***.***(https://github.com/GetStream/stream-chat-angular/releases/tag/v4.48.0)
About the second problem, which is that `offset` won't work if the
channel order changes between the channel queries: I wasn't able to
solve this from the client side. At this time, we don't have a
solution for this problem.
--
Reply to this email directly or view it on GitHub:
#505 (comment)
You are receiving this because you authored the thread.
Message ID:
***@***.***>
|
Hello,
There is a bug which can cause a user to never see some messages in the UI given the way that the Angular SDK is written.
Essentially, the problem is that the current way of handling pagination in the SDK works for only the most simplistic of cases. It doesn't take into account the filters. This can only be explained by way of example:
Let's say that you have 500 channels. And let's also say that you are using a filter of
has_unread
. Now, there is already a problem where if you have over 100 unread channels this filter doesn't work properly (known issue). But let's assume for a moment that problem isn't in play because we have less than 100 unread channels. For our example, let's also assume that we are loading 10 channels at a time, as it'll make the problem more apparent.We call
channelService.init()
and load the initial batch of channels. Assume we have 30 unread channels. We've loaded 10 unread channels. Now, we load the next batch of 10 by callingchannelService.loadMoreChannels()
. This queries the channels again with the same filter and anoffset
of10
, since that's the current count of the channel list.However, let's say that we're responding to messages and respond to 10 of them. We now have 10 channels that have unread messages loaded. So we want load the next 10. So we call
channelService.loadMoreChannels()
with anoffset
of20
... but... there are only 20 unread messages. So if we have 20 messages in ourchannelSubject
, when we query the channels again, no channels will be returned since there are none that match the offset.This can also happen, too, if channels populate via the web socket. Because the client
this.channels.length
is always used as theoffset
, it opens up the possibility that the next time the pagination occurs, it will skip or miss channels completely.The text was updated successfully, but these errors were encountered: