Skip to content
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

fix: use messages from props instead of state #2437

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

preynal
Copy link

@preynal preynal commented Aug 20, 2023

it's unclear why the messages were attached to state, but there was some effect resetting them, so the chat view was empty, even if it had messages.

the message container now uses the messages from props.

Copy link

@gajjardarshithasmukhbhai gajjardarshithasmukhbhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

Copy link

@anwersolangi anwersolangi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
I was facing the same issue on React Native Web on Expo, where, messages from props are appearing in console.logs, however, the state was not being updated. So, I think that this approach is good, however, if we use useCallback hook in the renderMessages function and pass messages as dependency array would make sure the re-render if any change happens in messages props.

@edwinvrgs
Copy link

This seems to solve #2411.

@preynal
Copy link
Author

preynal commented Nov 17, 2023

This seems to solve #2411.

this is the problem I had on the web too!

@deemyboy
Copy link

deemyboy commented Dec 5, 2023

why is this not merged yet?

@useEffects
Copy link

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants