lemmy-ui icon indicating copy to clipboard operation
lemmy-ui copied to clipboard

Javascript exception when loading a particular post/comment from a new tab

Open shaunol opened this issue 1 year ago • 1 comments

Issue Summary

A particular comment in a post is causing a Javascript error which in turn breaks all interactivity on the page.

Steps to Reproduce

  1. Open the post in a new tab: https://lemmy.world/post/15786
  2. Note Javascript error, https://i.imgur.com/djef1eZ.png
  3. More specifically it seems to be this comment causing the exception: https://lemmy.world/comment/31885

Technical details

  • Happens on all browsers
  • Breaks all navigation/page actions after the exception occurs
  • Exception does not occur when navigating to the post from another page (ie. directly from the community)

Sorry I'm not a Lemmy developer or instance admin so I cannot debug further than this or provide an isolated reproduction outside of this production instance/comment combination.

shaunol avatar Jun 10 '23 10:06 shaunol

Somehow this comment does not have a path, which breaks the getDepthFromComment function.

I've looked into the JSON data of that comment and it seems like it's both a comment and a post, e.g. it does not only have the attributes of a comment, but also those of a post. Obviously it's also missing the path attribute, and it has a duplicated creator_id attribute (with different value).

Maybe someone with more knowledge of Lemmy can chime in, but to me this looks like data corruption of some sort, that's manifesting in this error?


Relevant JSON snippet:

"comment": {
  "id": 31885,
  "creator_id": 23007,
  "post_id": 15786,
  "content": "<redacted>",
  "creator_id": 2,      // notice the duplication
  "community_id": 5,
  "removed": false,
  "locked": false,
  "published": "2023-06-07T20:24:50.268036",
  "updated": "2023-06-09T12:51:19.956587",
  "deleted": false,
  "nsfw": false,
  "embed_title": null,
  "embed_description": null,
  "embed_video_url": null,
  "thumbnail_url": null,
  "ap_id": "https://lemmy.world/post/15786",
  "local": true,
  "language_id": 37,
  "featured_community": true,
  "featured_local": false
},

fheft avatar Jun 10 '23 10:06 fheft

I just followed the lemmy world links and didn't get any JS errors. I checked the response the comment came in and didn't see the duplicate creator_id like @fheft pointed out. With this in mind, I am closing this story under the assumption that the issue was fixed in a version that was released after this issue was opened.

SleeplessOne1917 avatar Feb 16 '24 03:02 SleeplessOne1917