Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-74303

Activity tabs are not initialised

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 9.4.0
    • 9.1.0, 9.2.0, 9.3.0
    • Issue - Others
    • 9.01
    • 8
    • Severity 2 - Major
    • 42
    • Hide
      Atlassian Update – 27 December 2022

      Hello everyone,

      We’ve marked the issue as fixed in 9.4.0 with a delay because we were waiting for a confirmation from the affected customer that Activity tabs were loading properly on 9.4 and there was no need to use workarounds. We took this path as we couldn't reproduce the issue locally. However, we came up with some hypotheses of what may be happening there.

      In Jira 9.4, we've made the initialization of the Activity tabs more resilient by isolating the execution of event handlers (check the announcement in Preparing for Jira 9.4). Since 9.4, both JavaScript errors that happen inside jQuery onReady and Jira event handlers are logged in the dev console and they don't impact the execution of the remaining handlers.

      If you were affected by this issue, check your dev console to see if any extra errors are logged in. This will help us locate root causes more precisely.

      After the so-called “soaking time” on 9.4, we’ll consider backporting the change to previous Jira versions.

      Kind regards,
      Jira DC Team

      Show
      Atlassian Update – 27 December 2022 Hello everyone, We’ve marked the issue as fixed in 9.4.0 with a delay because we were waiting for a confirmation from the affected customer that Activity tabs were loading properly on 9.4 and there was no need to use workarounds. We took this path as we couldn't reproduce the issue locally. However, we came up with some hypotheses of what may be happening there. In Jira 9.4, we've made the initialization of the Activity tabs more resilient by isolating the execution of event handlers (check the announcement in Preparing for Jira 9.4 ). Since 9.4, both JavaScript errors that happen inside jQuery onReady and Jira event handlers are logged in the dev console and they don't impact the execution of the remaining handlers. If you were affected by this issue, check your dev console to see if any extra errors are logged in. This will help us locate root causes more precisely. After the so-called “soaking time” on 9.4, we’ll consider backporting the change to previous Jira versions. Kind regards, Jira DC Team

      Issue Summary

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Running Jira 8.x
      2. Upgrade to Jira 9.x
      3. Try to access an Issue Activity tab, it is not loaded
      4. Reload the page, the Activity tab will load

      Expected Results

      Activity tab show load in first access on the Issue.

      Actual Results

      It is necessary to reload the page to see activity tab.

      Workaround

      #1 To by pass this you can disable a dark feature in Jira: com.atlassian.jira.lazyload.activity.tabs

      To manage dark features, access the following URL as a Jira administrator account:

      <BASE_URL>/secure/admin/SiteDarkFeatures!default.jspa

      Disabling a Dark Feature

      In order to disable a feature flag, type <feature_flag_name>.disabled in the Enable dark feature text area and click the Add button. For example,

      com.atlassian.jira.lazyload.activity.tabs.disabled
      

       

      Make sure to not have double ".disabled" suffix at the end of feature flag name.

      OR

      #2 The following HTML snippet can be inserted into the announcement banner:
      (actually, in any place that renders HTML on the page or in any JS file, then w/o <script> tags, which is executed on PIN & GIN pages)

      <!-- BEGIN [JRASERVER-74303] -->
      <script>
      (function() {
          resourcePhaseCheckpoint.defer.then(() => {
              try {
                  const Events = require('jira/util/events');
                  const jQuery = require('jquery');
      
                  console.log('__ [JRASERVER-74303] applying fixes...');
      
                  // 1st part: isolating $onReady handlers
                  try {
                      const original = jQuery.fn.ready;
                      jQuery.fn.ready = function (fn) {
                          try {
                              return original.call(this, fn);
                          } catch (e) {
                              console.error('__ [JRASERVER-74303] An error occurred in one of the jQuery onReady callbacks', e);
                              return this;
                          }
                      };
                  } catch (e) {
                      console.warn('__ [JRASERVER-74303] could not isolate $onReady handlers', e);
                  }
      
                  // 2nd part: isolating JiraEvents handlers
                  try {
                      function isolateCallback(fn) {
                          return typeof fn === 'function' ? function isolatedCallback(...args) {
                              try {
                                  return fn.apply(this, args);
                              } catch (e) {
                                  console.error('__ [JRASERVER-74303] An error occurred in one of the JiraEvents callbacks', e);
                              }
                          } : fn;
                      }
      
                      (function(originalBind) {
                          Events.bind = function bindWithIsolatedCallbacks(types, fnOrEventData, fnOrFalse) {
                              originalBind(types, isolateCallback(fnOrEventData), isolateCallback(fnOrFalse));
                          };
                      })(Events.bind);
      
                      (function(originalBind) {
                          Events.one = function bindWithIsolatedCallbacks(evt, handler) {
                              originalBind(evt, isolateCallback(handler));
                          };
                      })(Events.one);
      
                  } catch (e) {
                      console.warn('__ [JRASERVER-74303] could not isolate JiraEvents handlers', e);
                  }
              } catch (e) {
              }
          });
      })();
      </script>
      <script type="module">
          require([], function() {
              resourcePhaseCheckpoint.defer.then(() => setTimeout(() => {
                  try {
                      const Reasons = require('jira/util/events/reasons');
                      const Types = require('jira/util/events/types');
                      const Events = require('jira/util/events');
                      const jQuery = require('jquery');
      
                      // 3rd part: re-initialising activity tabs
                      try {
                          const module = jQuery('#activitymodule');
                          if (module.length && !module.data('is-ready')) {
                              // it should already be marked as ready at this point
                              console.log('__ [JRASERVER-74303] re-initialising activity tabs ...');
                              Events.trigger(Types.NEW_CONTENT_ADDED, [module, Reasons.panelRefreshed]);
                          }
                      } catch (e) {
                          if (module.data('is-ready')) {
                              console.warn('__ [JRASERVER-74303] Activity tabs should be init. now, but some other error occurred', e);
                          } else {
                              console.error('__ [JRASERVER-74303] could not re-init. Activity tabs', e);
                          }
                      }
                  } catch (e) {
                  }
              }));
          });
      </script>
      <!-- END [JRASERVER-74303] --> 

              mrzymski Maciej Rzymski
              a0a054388f60 Mikaela Teixeira
              Votes:
              4 Vote for this issue
              Watchers:
              15 Start watching this issue

                Created:
                Updated:
                Resolved: