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

[MM-62462] Plugin link tooltip for Jira plugin opens takes a very long time to load #1145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

M-ZubairAhmed
Copy link
Member

@M-ZubairAhmed M-ZubairAhmed commented Jan 9, 2025

Summary

Changes to adopt with the new plugin link tooltip component for this plugin

Ticket Link

Fixes https://mattermost.atlassian.net/browse/MM-62462

Screenshot

CleanShot 2025-01-09 at 15 12 23

Notes

This is a breaking change and should be included in Mattermost v10.5 thats where mattermost/mattermost#29727 is scheduled to be added

@M-ZubairAhmed M-ZubairAhmed changed the title [MM-62462 Plugin link tooltip for Jira plugin opens takes a very long time to load [MM-62462] Plugin link tooltip for Jira plugin opens takes a very long time to load Jan 9, 2025
@M-ZubairAhmed M-ZubairAhmed requested a review from hanzei January 9, 2025 09:52
@M-ZubairAhmed M-ZubairAhmed added the 2: Dev Review Requires review by a core committer label Jan 9, 2025
Copy link
Collaborator

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

A couple of questions from my side:

  1. Do we also need to update https://github.com/mattermost/mattermost-plugin-github?
  2. Given this is a breaking change, do we need to mention it in the changelog?
  3. Do we need to cut a new release of the JIRA plugin and repackage it with v10.5?

@@ -77,18 +77,17 @@ export default class TicketPopover extends React.PureComponent<Props, State> {
return null;
};

componentDidUpdate() {
componentDidMount() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does that mean we query the API on every mouseover?

Copy link
Member Author

@M-ZubairAhmed M-ZubairAhmed Jan 9, 2025

Choose a reason for hiding this comment

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

Yes, plugins can implement caching on their side to avoid repeated API calls if they want. However, from the webapp performance perspective, this component will get unmounted and remounted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the JIRA plugin implement such caching? In other words, does the tooltip load as quickly as before the webapp before on the 2nd mouseover?

Copy link
Member Author

@M-ZubairAhmed M-ZubairAhmed Jan 9, 2025

Choose a reason for hiding this comment

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

It loads depending on the network request resolution. Does that answer your question?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not quite. Previously (If I remember correctly), the webapp would only make one network request per link. Is that still the case? I'm concerned about the number of API requests we make to JIRA, which has caused issues in the past.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was no caching mechanism in place previously, and that remains the case. The webapp still makes a single request per link. However, the performance improvement from the new implementation — particularly by preventing memory leaks present in the previous approach — far outweighs the impact of this minor change.

Copy link
Member

Choose a reason for hiding this comment

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

Testing it on Hub, the current version sort of implicitly caches these because the TicketPopover stays mounted for as long as the user keeps a channel, so it'll only load once per channel switch when the user mouses over a Jira link. The same applies to links on posts in the RHS or Threads view.

If I'm reading the code right, the new logic will make the TicketPopover remount any time the user mouses over and off of a link, so it will make more requests, but I'm not sure how meaningful of a difference that will be unless a user repeatedly does that on purpose. It would be more impactful for keyboard users tabbing over the elements which I'm hesitant to downplay given our focus on accessibility, but I don't know how common that actually is.

Ideally, I think this would be addressed in the Jira plugin by caching it since it's kind of a happy accident that it "cached" data as well as it did before. This is yet another case where loading and caching data effectively is hard.

Overall, I think it's still worth it to make this change to address the side effect of the memory leak despite the potential increase in the number of requests, but I think it'd be good to schedule a followup ticket to improve the caching on the plugin side

Copy link
Member

Choose a reason for hiding this comment

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

@M-ZubairAhmed
Copy link
Member Author

  1. Do we also need to update https://github.com/mattermost/mattermost-plugin-github?

A couple of questions from my side:

1. Do we also need to update https://github.com/mattermost/mattermost-plugin-github?

2. Given this is a breaking change, do we need to mention it in the changelog?

3. Do we need to cut a new release of the JIRA plugin and repackage it with v10.5?
  1. That plugin is not effected because it uses the useEffect with correct dependency
  2. Yes we need to mention, i mentioned in the webapp changelogs
  3. Yes added you to the thread in Staff team

@M-ZubairAhmed M-ZubairAhmed requested a review from hanzei January 9, 2025 11:44
Copy link
Collaborator

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

I'm still not sure if the number of requests to the JIRA plugin changes with this PR or not. Per https://github.com/mattermost/mattermost-plugin-jira/pull/1145/files#r1910298062, I suppose it doesn't.

QA should check that during testing.

@wiggin77 wiggin77 requested a review from hmhealey January 14, 2025 20:50
@wiggin77
Copy link
Member

@M-ZubairAhmed let me know when this is merged so I can create a release and update the prepackaged version in MM.

@wiggin77
Copy link
Member

@M-ZubairAhmed the minimum server version will need to be updated in plugin.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants