-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-42320 Remove excess keyboard listeners from post components #9708
Conversation
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.
LGTM ... although I feel like all of these components do basically the same thing and we can probably extract it into one component that is being used anywhere a text input is needed.
WDYT @hmhealey @matthewbirtch ?
PS: this is definitely OOS for this PR, but we should definitely think about it!
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.
🆗 It looks good to me. Thank you
Yeah, that's 100% something I'd like to do. The post components (and post textboxes) have so much duplicated code, but they're not something we've had a chance to get to yet. We do have a goal for the year to refactor some areas of heavy tech debt, and those are both high up for me on that list. Alternatively, I feel like that could make a good custom hook, but we can't do that either until these components are rewritten to be functional |
//update-branch |
/e2e-test |
Triggering e2e testing with options: |
Successfully triggered e2e testing! |
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.
Thanks @M-ZubairAhmed
Tested, looks good to merge.
- Verified cursor turns to a hand pointer when holding alt and hovering over a post. Additionally, when holding alt key while the mouse cursor is not hovering over any post, the cursor is not changing to hand pointer.
- E2E report looks good, no PR related failures.
Test server destroyed |
/cherry-pick release-6.3 |
Cherry pick is scheduled. |
…rmost#9708) * MM-42320 Remove excess keyboard listeners from post components * Update snapshots Co-authored-by: Mattermod <[email protected]> (cherry picked from commit ad36421)
#9800) * MM-42320 Remove excess keyboard listeners from post components * Update snapshots Co-authored-by: Mattermod <[email protected]> (cherry picked from commit ad36421) Co-authored-by: Harrison Healey <[email protected]>
Similar to #9707, each post renders a keyboard handler to detect whether or not alt is pressed because that switches the cursor to show that you can click on a post to mark it as unread. This happens once for each post on the screen which can add a bit of processing time when a user is typing a message.
By only registering those handlers when the user hovers over a post, we ensure that we only have one registered at a time at most which should hopefully speed up typing performance slightly.
Ticket Link
https://mattermost.atlassian.net/browse/MM-41320
Related Pull Requests
#9707
Screenshots
Here's a before and after with log statements added to the listeners.
Before:
before.mov
After:
after.mov
Release Note