links
links copied to clipboard
Weird interaction with Chrome JavaScript Console when sorting
I'm seeing some odd behaviour that only happens when the Chrome JavaScript Console is open (Chrome version 91.0.4472.106, MacOS 11.4 (Big Sur)). I've not labelled this as a bug because I'm not sure if it can be fixed on the Links side. I'm recording it in case other people run into it.
Due to #977, I've been using functions such as the following for sorting on the server
fun sortMultiMods (mms) server {
for (x <- mms) orderby (x.wd,x.cn) [x]
}
The sort function with the server annotation works nicely. However, if the Chrome JavaScript Console is open, once the sorting is finished (and the resulting page is shown in the browser), the JS Console gets a continual stream of messages that brings the browser almost to a halt, and stops interaction with any of the developer tools provided. I haven't been able to discover what these messages are because I'm not particularly experienced with these tools.
I've tried to modify the code from #977 to trigger this behaviour but with no success -- I think it may require much longer lists. I can do more work to find a MWE, and I can also do more experiments with my code if anyone has suggestions for what to try next.
I also saw the same behaviour when using sortBy, but this is not surprising if orderby uses sortBy
orderby uses sortByBase, but the Links code for sortByBase and sortBy is identical. So the problem is probably nothing to do with orderby per se, my guess would be that some kind of warning is being raised on each iteration because we are trying to compare two things that JavaScript doesn't like comparing, and this is silently failing if the console isn't open.