-
Notifications
You must be signed in to change notification settings - Fork 356
CRNS-116: Channel preview tests and hooks #251
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
CRNS-116: Channel preview tests and hooks #251
Conversation
…e into vishal/channel-preview-messenger-tests
…t-native into vishal/channel-preview-messenger-tests
71b93de to
eab5de0
Compare
eab5de0 to
9001c9d
Compare
9001c9d to
8f80d79
Compare
virdesai
left a comment
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.
I'd like to say we should try to alphabetize things for best practice like lists where order doesn't matter, and objects based on key name or functions based on name. make it easier to search within the code if it's following some natural mental flow
src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js
Outdated
Show resolved
Hide resolved
| "prettier": "^1.16.4", | ||
| "react": "^16.5.0", | ||
| "react-dom": "^16.8.6", | ||
| "react-native": "0.61.5", |
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.
is there a reason why we're a couple versions behind on RN?
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.
@DanC5 Yeah, I can't seem to remember exactly but it was breaking for 0.62 and 0.63. But give it a shot!!
| return () => { | ||
| channel.off('message.new', handleNewMessageEvent); | ||
| }; | ||
| }); |
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.
do you want these to setup just on mount/unmount?
| }); | |
| }, []); |
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.
tested this and the listener won't fire on each new message if we only call on mount. we have an issue tho where when you send a message in a Channel and then nav back to the ChannelList, the ChannelPreview still holds the original value and not the most recent message, looking into it now
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.
Ahh shit ... stupid mistake on my end!!
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.
@vishalnarkhede i fixed it, all good!
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.
the useLatestMessagePreview useEffect needed to be triggered on lastMessage, not channel
| return () => { | ||
| channel.off('message.read', handleReadEvent); | ||
| }; | ||
| }); |
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.
do you want these to setup just on mount/unmount?
| }); | |
| }, []); |
|
|
||
| ChannelPreview.propTypes = { | ||
| channel: PropTypes.object.isRequired, | ||
| client: PropTypes.object.isRequired, |
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.
this is no longer a required prop as we're pulling it from ChatContext, right?
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.
true, and we're going to axe all these prop types anyways shortly with TS
src/components/ChannelPreview/__tests__/ChannelPreviewMessenger.test.js
Outdated
Show resolved
Hide resolved
src/components/ChannelPreview/__tests__/ChannelPreviewMessenger.test.js
Outdated
Show resolved
Hide resolved
…me.js Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
…me.js Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
…atar.js Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
…r.test.js Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
…r.test.js Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
Co-authored-by: Vir Desai <virdesai@users.noreply.github.com>
…etStream/stream-chat-react-native into vishal/channel-preview-messenger-tests
Submit a pull request
CLA
Description of the pull request