-
Notifications
You must be signed in to change notification settings - Fork 144
fix: message not getting updated in real time #916
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
| messageText: message?.message, | ||
| }); | ||
| }, [message?.updatedAt]); | ||
| }, [message]); |
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.
@ishubham21 Thanks for your contribution and the detailed explanation. I see your point.
| }, [message]); | |
| }, [message?.message]); |
I wonder ^ this would this fix your issue too. I think this value will be updated when the streaming message is coming.
The reason I'm asking is, putting the whole object in the dependency array is not an optimal way in terms of performance.
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.
@AhyoungRyu
Definitely this will fix the issue we are facing. This PR was just an indicative solution - the root cause lies with updatedAt not being set properly.
If we proceed with this change, can we do this for scroll events as well? I believe they too have their dependencies set as updatedAt and thus might need an update as well
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.
Yeah if you're talking about this part, will make the change as well.
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.
@AhyoungRyu yes that’s the part. Thank you for pointing it out. Should I push the update, or sendbird team will do it?
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.
Oh I'll do that. Thanks for confirming it :)
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.
@ishubham21 Since we're not accepting the code change from outside at the moment, I made a separate PR based on yours. #928
We're aiming to publish a new version this afternoon. We'll let you know once it's out.
Thanks again :)
> This change is originally made by @ishubham21 at #916. Please refer to this PR for more detailed background. `message.updateAt` won't be updated if the message is coming from a bot especially in streaming. Its value gets just `0`. I added one more field `message.message` to the dependency array so we can make sure the hook is being executed again. Thanks @ishubham21
Issue Description
Currently, when a bot starts streaming messages, it does not reflect on the Channel UI. The reason for the same is that here we are using
message?.updatedAtas our dependency. Now, for some reason, updatedAt is coming out to be 0, causing the dependency to have no impact. Have updated it to message to make sure it works fine. Though, the root of problem still lies in message.updatedAt coming out to be 0.Replication
src/modules/Channel/components/Message/index.tsx, add a log to output themessageprop.message.updatedAtis coming out to be 0.Screenshots
Object