The page slows down a ton and hundreds of errors get printed because of an undefined variable on the Leads page.
There would not be errors in my browser console.
There are hundreds of errors in my browser console and the page slows to a crawl.
Not sure!
You can reproduce this on the demo site or on a locally hosted site running 7.10.x-hotfix, I'm not sure when it was introduced but it's been there at least since 7.10.18. I recommend using 7.10.x-hotfix if you can, since the location of the code has changed with some recent PRs (the PRs don't seem to have made any difference, however)
sugar_grp1.js (sugar_3.js in the actual source).In Firefox the error is TypeError: document.MassUpdate is undefined, in Chrome it's Uncaught TypeError: Cannot read property 'uid' of undefined.
This causes my browser to slow down to a crawl, it's practically unusable when I hit this bug.
It looks like #7244 is the same error, but they don't seem to have consistent reproduction steps.
I think this is the original cause of the problem: https://github.com/salesagility/SuiteCRM/commit/182804bdea8d3240de44e16492cb88b75acd6396
I think we might be able to revert this commit to fix the issue, without causing a regression in the behavior of the selected count thanks to @lazka's recent PRs.
I guess get_checks_count() needs a check for document.MassUpdate being undefined, like everything else..
Yeah, also it's not quite as easy as reverting the commit that introduced the problem originally, since this commit changed the function a lot: 98383248676747b1bc068c066aa3f3f0aebb6821
Changing the function to this seems to fix it:
sugarListView.get_num_selected = function () {
if (document.MassUpdate != 'undefined') {
var the_form = document.MassUpdate;
if (typeof the_form != 'undefined' && the_form.select_entire_list.value == 1) {
var selectCount = $("input[name='selectCount[]']:first");
if (selectCount.length > 0)
return parseInt(selectCount.val().replace("+", ""));
}
}
return sugarListView.get_checks_count();
}
by 'the function' I mean get_num_selected, to be clear.
And we can probably remove typeof the_form != 'undefined' from the fourth line.
After 7.11.8 I checked every file, your fix proposed https://github.com/salesagility/SuiteCRM/commit/98383248676747b1bc068c066aa3f3f0aebb6821 have been committed.
But sorry to say that I still got the issue... This fix dosent worked for me, and now I dont really know how to fix it cause of all thoses file change.
EDIT :
Fixed my issue by adding this code on line 352 of /SuiteCRM/cache/include/javascript/sugar_grp1.js:
sugarListView.get_checks_count=function(){
// Return 0 if MassUpdate is undefined, to prevent an undefined property error.
if (typeof document.MassUpdate == 'undefined') {
return 0;
}
ar=new Array();if(document.MassUpdate.uid.value!=''){oldUids=document.MassUpdate.uid.value.split(',');for(uid in oldUids){if(typeof(oldUids[uid])!='function'){ar[oldUids[uid]]=1;}}}
I found my old topic : https://github.com/salesagility/SuiteCRM/issues/7244
So I've opened an old backup and found that was the only difference in the two file. Now I dont have the issue anymore.
I'm not sure I follow what's different about those lines you've shared vs the one in #7627?
@connorshea Thats exactly this (your) code, yes. Now when I look a the fix-link in my post IDK why I posted that, its for another bug lol...
Not really used to github, im a young dev, its the first time I use this thing.
So your fix was not merged to the final release for now right ?
No problem, just wanted to make sure I wasn't missing anything :)
And no, it hasn't been merged yet.
Is it possible to higher the priority of this issue?
The Browser goes insane, it is not possible to normally work with this issue!
Hi @artjomsmorscakovs, this will be fixed in the next 7.10.x and 7.11.x release. Thanks!
Is there a fix for this I can apply now to 7.11.8 - I've tried what is detailed on #7627 with no joy, and I'm seeing this error in other modules too, in both edit and detail views.
thanks.
@MattForrest Backporting #7627 should be sufficient as far as I know. If you're using git, you can download the patch file from https://github.com/salesagility/SuiteCRM/pull/7627.patch and use git apply 7627.patch to apply the changes. You'll need to do a quick repair and rebuild, though. You may also need to hard-refresh your browser or clear your cache.
@connorshea all working now, browser cache was the issue.. 🤦♂️ - basics!
Thanks for the fix! Can confirm it's working on 7.11.8 😀
"Repair JS Files" has always helped here to invalidate the cache.
I'm pretty sure this was resolved by #7627 in 7.10.21/7.11.9.
Most helpful comment
I'm pretty sure this was resolved by #7627 in 7.10.21/7.11.9.