themotte / rDrama

This code runs https://www.themotte.org. Forked from https://github.com/Aevann1/rDrama
GNU Affero General Public License v3.0
25 stars 31 forks source link

Posting comments in deeply nested threads hangs #594

Closed zorbathut closed 9 months ago

zorbathut commented 1 year ago

From cjet79:

When posting a comment in a deeply nested thread. (deep enough that any subsequent comments will be minimized. I think 9 comments deep.) When clicking "comment" the page will hang.

There is also a javascript error that gets thrown in the console: Uncaught TypeError: comments is null onload https://www.themotte.org/assets/js/comments_v.js?v=a90eb7d7:293 post_comment https://www.themotte.org/assets/js/comments_v.js?v=a90eb7d7:280 onclick https://www.themotte.org/post/508/culture-war-roundup-for-the-week/103865?context=8#context:1 comments_v.js:293:4 onload https://www.themotte.org/assets/js/comments_v.js?v=a90eb7d7:293 (Async: EventHandlerNonNull) post_comment https://www.themotte.org/assets/js/comments_v.js?v=a90eb7d7:280 onclick https://www.themotte.org/post/508/culture-war-roundup-for-the-week/103865?context=8#context:1

refreshing the page will show that the comment was successfully posted

My best guess is that is an async error, and the page is trying to load the "more comments" button before the comment has been fully saved and retrieved from the server

image

justcool393 commented 1 year ago

can reproduce, might be related to ?context???

image

image

it's worth noting the comment does actually get posted, it just doesn't get inserted into the tree.

image

it looks like there simply isn't a replies-of-<id> div anywhere in there.

compare a different leaf which does have the div, even if empty

image

zorbathut commented 1 year ago

Seems to still be happening.

gldrk commented 9 months ago

There are two code paths involved here. This PR only changed the rendering for shoah’d comments (where it ironically doesn’t matter). Needless to say, someone should rewrite that template so that there aren’t two largely identical paths.

zorbathut commented 9 months ago

Aha! That makes sense. Many thanks for doing the legwork on this, I'll get it live soon :)

zorbathut commented 9 months ago

Should now be live!