DOM elements created with JavaScript disappear after any update in issue view

I use Atlassian Web-Resource Webpack Plugin + React for my Jira server plugin. After loading the issue view, react renders my app into container div that I added into issue left context. But after any update in issue (e.g. adding description), the issue view seems to refresh and all of my HTML generated by React disappear. Is there any hook or event on Jira UI I cal listen to, so that I can rerender my app after issue view refresh?

Hello this is documented here:

AJS.$(function() {
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {
        var $context = AJS.$(context);
        // Find our web panel. Handles the pageLoad and panelRefreshed reasons.
        var $webPanel = $context.find("*").andSelf().filter("#my-web-panel");
        if ($webPanel.length > 0) {
1 Like

May i know if this solution is still valid? The below line

var $context = AJS.$(context);

gives the error

VM441:4 Uncaught SyntaxError: Invalid or unexpected token

Your question is unique. Ask a new question.

Thank you. I have created a new question with the actual issue.

As an alternative you could take a look at React WebComponents, which makes it more easy to register components and use them at any place.
But attention, don’t use the HtmlElements Polyfill for IE 11. This may seem to work, but will have a huge impact on the IE render times.

1 Like