gokibitz
gokibitz copied to clipboard
Load comments immediately for a given game.
http://lifein19x19.com/forum/viewtopic.php?p=202978#p202978
From UberDude: So the reason I couldn't see comments is because I followed the link, and then held down my right arrow key to whiz through the game and no comments appeared as the stones appeared on the board. That's because the comments are loaded asynchronously by ajax and take a long time to appear, by which time you've moved on to the next move (so you get loads of js errors). I suggest the developer stores a list of the moves with comments on first load (edit: it already has this as on move 0 it lists the moves with comments) so that when you whiz through it knows to display a "Loading comment" message on relevant moves (and not to issue the ajax request for comments immediately on moves the cache suggests have no comments (but have a small chance to have been commented since initial page load)), but wait a short time to reduce the request spam which is presumably why it is a lot slower to load comments after whizzing through moves that if you directly navigate to one with a fresh page request.
My thoughts: Can provide the most recent comment hash, and if it doesn't match the server, the server can return an updated list of comments, otherwise, no need to send any additional data back and forth from the initial load?
It's definitely possible to load all the comments in advance, and I think I'm going to do that in an upcoming refactor. The reason I didn't initially is that it's simpler from an architectural perspective not to have a copy of all the comments on a game maintained in the browser that then needs to get updated whenever another user adds comments to the game elsewhere. Every move is its own thread; just fetch that thread when needed. It also helped keep AJAX calls quick even when games had a lot of comments.
But UberDude's suggestion of just keeping track of which moves have comments so that it can display an obvious loading message is a good way of dealing with that issue.
Anyway -- this will be something I try to address in the future.
this seems to converge with issue #120 , maybe only one needs to be up. I think it's a very important feature, I currently miss many comments (or otherwise force myself to browse the games very slowly) when browsing games due to this.
I'd like to bump this. :)
Loading all the comments in bulk when opening a game shouldn't pose any performance issues and should make comments to display instantaneously, I think?
It would be nice to have a keyboard shortcut (e.g. N) to go to the next commented move
I'm afraid that development on GoKibitz is effectively pinned right now. Dependencies are so out of date that it's pretty much impossible to make changes.