mattermost-webapp icon indicating copy to clipboard operation
mattermost-webapp copied to clipboard

[MM-45789] Don't update redux state unless something has actually changed

Open BenCookie95 opened this issue 2 years ago • 0 comments

Summary

We are currently unable to open the profile popover from the Channel member RHS list because opening the popover triggers a request to fetch channel member information which causes the RHS list to re-render and close the popover immediately.

I tried to refactor the RHS list like Caleb suggested in the ticket and I moved the selector for the member information into the child component (Member). This solved the render issue but it meant that we couldn't order/sort the list correctly and I was unable to work around that without having the channel member info present in the parent components. From what I can tell, the selectors are functioning correctly and memoizing the components didn't impact the outcome.

I decided to make this change in the reducer, this means that when we open the popover we will only update the member information if something has changed. We use this approach for posts as well in order to cut down on re-renders. This means that the only edge case for the popover not opening will be if I have the RHS open in my app, someone else changes something about that members info (i.e change their channel role), and then I click their profile to open the popover. This isn't the ideal solution but it's good enough for now.

Refactoring the RHS list is a much bigger task that would likely involve server and possibly redux tree changes.

Ticket Link

https://mattermost.atlassian.net/browse/MM-45789

Related Pull Requests

  • Has server changes (please link here)
  • Has mobile changes (please link here)

Screenshots

Release Note

Fixed a bug that wouldn't allow the user to open the profile popover from the RHS channel member list

BenCookie95 avatar Oct 25 '22 16:10 BenCookie95