stream-chat-react-native
stream-chat-react-native copied to clipboard
`isAttachmentEqual` is not used in `MessageSimple` component memoization
Describe the bug
In the Channel component, it's possible to override the isAttachmentEqual method that will be used in memoization to check if an attachment has been updated or not. This method is used inside the MessageContent component, but not inside the MessageSimple one. That will lead to refresh issues if using the MessageSimple component.
Dev environment info (please complete/provide the following information):
- Package version (stream-chat-react-native/stream-chat-expo): stream-chat-expo
- react-native or expo version: expo 45.0.0 / react-native 0.68.2
- Device/Emulator (android/ios) and OS version: iOS 15.5
To Reproduce Steps to reproduce the behavior:
- Upload a custom attachment (in our case an audio file that will be handled by the backend)
- Once uploaded, the custom attachment have some default attributes and states (loading, not ready)
- From the backend, update the attachment (ready state, and preview URL - for example scrapping, or streaming URL)
- On the app, see that even if you override the
isAttachmentEqualmethod, the attachment is not properly render
Expected behavior A clear and concise description of what you expected to happen.
I would expect the same logic for checking attachments, on both the MessageSimple and the inner MessageContent components. See here: https://github.com/GetStream/stream-chat-react-native/commit/c663e5297dbee9553f835cd0ebb17e1964df45d0 for the difference between the two. One is using the isAttachmentEqual hook, and the other is not.
Additional context Add any other context about the problem here.
Screenshots If applicable, add screenshots to help explain your problem.
Hey @ludovicthomas, on testing the changes locally it even works without adding the same change in MessageSimple component. I think there's some other issue you might be stuck into. It will really be helpful if you can share your code snippet or a minimum reproducible repository with the changes you are working on so that we can test it on our end. Thanks :)
Hey @ludovicthomas, are you still facing this issue?
Sorry for the late reply. Will try to show quickly what is the issue from our side today
This issue is solved by doing what @khushal87 says, I'll be closing this.