sourcebans-pp
sourcebans-pp copied to clipboard
JS Bug when clicking on toggler before page loaded completely
Hi,
me and others realized a bug (in a quite new version 1.5.5-dev-git357) where you cant collapse the details of a ban entry. This just seems to happen sometimes when you try to click on a ban entry before the page finished loading completely. When this bug appears, it throws an error on browser console telling me that the toggler variable (sourcebans.js line 191) is undefined and therefore the access to its property fails. I tried it with the following simple workaround:
onActive: function(toggler, element){
if(toggler) {
toggler.setStyle('cursor', 'pointer');
toggler.setStyle('background-color', '');
} else {
console.warn("Toggler undefined, page is not completely loaded yet!");
}
},
onBackground: function(toggler, element){
if(toggler) {
toggler.setStyle('cursor', 'pointer');
toggler.setStyle('background-color', '');
} else {
console.warn("Toggler undefined, page is not completely loaded yet!");
}
}`
Well at least the code execution went on this way and i was able to collapse ban details, BUT: when i now tried to collapse the ban details, the details of another ban entry opened up. The reason for that: this.elements is always 30 entries big (the number of entries) but when the bug appears this.togglers has just 29 entries (after a while i just realised one case where it have been just 27). So far it was always the first ban entry missing (in the mentioned case also entry 3 and 5 where missing). This at least explains the initial error message: one entry was missing in the array so it accessed an not existing entry from array (undefined) and then aborted in line 191.
But finally I had to give up, takes too much time to dive depper inside those undocumented codes. I have no clue why and where the entry gets lost but I hope my informations are helpful enough to find the bug.
pardon the bump. This issue is still present in the current release, i believe i've seen it for 5 years so far, so i don't mind having it stay as such, but if it's not too hard, it'd be nice if it was looked into.
You can test it on my installation: https://bans.elite-hunterz.info/
Greetings, Niko
It's been 2 years. I see there was another issue opened but I don't believe the cause was correctly diagnosed. Isn't anyone else experiencing this? https://github.com/sbpp/sourcebans-pp/issues/274