mattermost/mattermost-plugin-jira

Jira link tooltip error: When a render error happens for the link tooltip, this error occurs for all Jira ticket links currently visible in the center channel

mickmister opened this issue · 2 comments

This sanitized version of data that produced the issue can be used for testing. In the code below, it is the value of the data variable, so it can be hardcoded to the contents of this data file for testing.
jira-plugin-test-data.json

Also we should probably change the function signature below to jiraIssueToReducer(data: TicketData | undefined) as this is the case on first render of the page, before hovering on a Jira link. We should avoid calling this function before hovering over the particular link. This may be a change to be properly made in the core webapp, but we should handle it in the plugin first.

export function jiraIssueToReducer(data: TicketData): TicketDetails | null {
if (!data) {
return null;
}
const assignee = data && data.fields && data.fields.assignee ? data.fields.assignee : null;
const ticketDetails: TicketDetails = {

Also I noticed when this error happens, the error shows several times. It seems to happen for every post that is visible at that time that contains a Jira ticket link. The error also shows on other tooltips (like GitHub links) after the first error happens.

I believe this means we may be attempting to fetch (if no error were to occur) all of the issues at once, upon the first hover of a Jira ticket link. Navigating to a different channel that contains posts with Jira ticket links causes those to all have errors as well. Note that at the moment, only one request is made upon hover on a Jira ticket link. No other request is made, even when hovering on other links or navigating to another channel.

Related issue: #1014


As a side note, the webapp makes it so when this error happens, it catches the error using an ErrorBoundary, to avoid having the error bubble up and crash the webapp.

CleanShot 2024-01-08 at 15 35 58

@raghavaggarwal2308 I think we should generally avoid using redux for this feature, and favor local state of the individual link tooltip components. I'm thinking that has something to do with triggering other Jira ticket link processing when we first hover one of the links

@mickmister I tried removing the redux code and using the local state. That does solve the issue.

The error also shows on other tooltips (like GitHub links) after the first error happens.

Although, I was wondering why this was breaking the tooltip for other plugins. Do you have any idea about that?