Skip to content

Conversation

@MartinCupela
Copy link
Contributor

🎯 Goal

Reflect updates to user's data in:

  • 2-members channel preview
  • Avatar (in MessageList, Thread, ChannelPreview)

fixes #1565

🛠 Implementation details

MessageList

The change's are performed upon reception of WS event user.updated. The implementation takes into account that a user can have custom fields and therefore the memoization in MessageList takes this into account. Until now, the changes were propagated to the most bottom components only if user's image or name changed. Those are default attributes. Therefore if a custom Avatar component displays custom user data, their update would not be reflected until page is refreshed.

ChannelPreview

The ChannelList component neither its children were listening to user.updated event and therefore the event listener has been added to the ChannelPreview's effect.

Out of scope

ChannelHeader does not display image if the channel is DM channel (channel.data.name === undefined). This could be considered a bug or insufficiency. The ChannelHeader should probably behave the same way as ChannelPreview in terms of its title and displayed image to support consistency. This is out of scope of this PR, because it would introduced breaking changes in form of changed component behavior.

@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #1566 (26e663e) into develop (b732527) will increase coverage by 0.31%.
The diff coverage is 89.47%.

@@             Coverage Diff             @@
##           develop    #1566      +/-   ##
===========================================
+ Coverage    78.83%   79.14%   +0.31%     
===========================================
  Files          225      227       +2     
  Lines         5802     5812      +10     
  Branches      1635     1634       -1     
===========================================
+ Hits          4574     4600      +26     
+ Misses        1085     1064      -21     
- Partials       143      148       +5     
Impacted Files Coverage Δ
...ents/Channel/hooks/useCreateChannelStateContext.ts 87.17% <50.00%> (ø)
src/components/Message/utils.tsx 88.03% <66.66%> (+0.53%) ⬆️
src/components/ChannelPreview/ChannelPreview.tsx 96.15% <100.00%> (+1.03%) ⬆️
src/mock-builders/event/userUpdated.js 100.00% <100.00%> (ø)
src/components/Thread/index.ts 100.00% <0.00%> (ø)
src/components/MessageList/MessageList.tsx 88.31% <0.00%> (+1.29%) ⬆️
src/components/Message/MessageOptions.tsx 92.50% <0.00%> (+2.50%) ⬆️
...s/MessageList/hooks/useMessageListScrollManager.ts 97.14% <0.00%> (+8.57%) ⬆️
src/components/MessageList/utils.ts 68.26% <0.00%> (+9.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b732527...26e663e. Read the comment docs.

@arnautov-anton arnautov-anton merged commit 3376e4c into develop May 9, 2022
@arnautov-anton arnautov-anton deleted the fix/propagate-user-update-data-to-UI branch May 9, 2022 08:51
@MartinCupela MartinCupela mentioned this pull request May 15, 2022
github-actions bot pushed a commit that referenced this pull request May 15, 2022
## [8.1.3](v8.1.2...v8.1.3) (2022-05-15)

### Bug Fixes

* do not scroll thread message list when a new message is received ([#1568](#1568)) ([b17c48a](b17c48a))
* propagate user update data to UI ([#1566](#1566)) ([3376e4c](3376e4c))
@petyosi
Copy link
Contributor

petyosi commented May 15, 2022

🎉 This PR is included in version 8.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: neither ChannelPreview nor MessageSimple reflect changes signaled by user.updated event

4 participants