compucorp / uk.co.compucorp.civicase

CiviCase Extension
Other
8 stars 16 forks source link

Angular error breaks activity tab page #879

Open allinappliadmin opened 2 years ago

allinappliadmin commented 2 years ago

We ran the fork from @bgm for WP on different recent versions of CiviCRM (now on 5.54) with the necessary plugins and configuration and trying to access the activity tab breaks the tab and blocks the instance.

https://www.loom.com/share/e64939e649d446578144fd79e3a2c826

We've already spent hours trying to debug: deactivate all extensions, activate them one by one, change php version, upgrade and downgrade versions of CiviCRM, update extension, ask @bgm to investigate, migrate to a new website... It crashes the instance, blocks the browser and even froze the computer.

All errors are related to angular.js file:

Possibly unhandled rejection: {"readyState":4,"responseText":"<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n","status":504,"statusText":"Gateway Timeout"}

TypeError: contactObj is null
    Angular 23
    jQuery 5
 Possibly unhandled rejection: {} angular.js:15697:15
    Angular 23
    jQuery 5

InternalError: too much recursion
    Angular 7
angular.js:15697:15

and especially this line: return Function.prototype.apply.call(logFn, console, args);

I can provide credentials to see the issue live.

I read that the extension is supposed to work only with 5.39 but on versions such as the 5.49 it was working.

Have you noticed such an issue

mlutfy commented 1 year ago

I did a bit of digging on this issue, and it seems to be specific to WordPress. I tested on CiviCRM 5.55 with Drupal7, both the original Compucorp version and our fork, and that worked fine.

One potential lead: if we patch civicrm/templates/CRM/common/TabHeader.js, around line 23, to remove this lINE:

      .on('tabsactivate', function(e, ui) {
        var tabId = ui.newTab.attr('id');
        if (tabId && tabId.length) {
          tabId = tabId.slice(4); // Remove leading 'tab_'
          // history.replaceState(null, '', updateUrlParameter('selectedChild', tabId));  // <-------  comment out
        }
      })

then the problem seems to go away.

selectedChild a useful feature though, so the above is just a temporary workaround.

allinappliadmin commented 1 year ago

it seems that it solved on WP (exact path is plugins/civicrm/civicrm/templates/CRM/common/TabHeader.js) awaiting for client's feedback but it looks great :-)

mlutfy commented 1 year ago

A very weird discovery (without the selectedChild workaround):

And everything works fine ... edit: except the activities tab.

Other random findings: loading the Membership tab initializes CiviCase because of this, I think:

image

allinappliadmin commented 1 year ago

:-| strange indeed

allinappliadmin commented 1 year ago

same issue and fix on 5.56beta1

mlutfy commented 1 year ago

@allinappliadmin It's unlikely to be fixed by core. I had to stop debugging because I was turning in circles. For now we are applying the TabHeader.js fix on our builds.

Guydn commented 1 year ago

With the patch, i am not able to open the activity from the list of activities. @mlutfy

Guydn commented 1 year ago

An interesting workaround is a search kit / form on activities, as a tab in the contact summary. It is possible to expose filters and I think it could be a very good option.