redd
redd copied to clipboard
comment.replies not working consistently
This will probably be really vague and not helpful to debug, bug earlier I was able to get the Listing of comment replies from a Comment with the_comment.replies but now it returns an empty listing. The comments I'm applying it to very definitely has replies, so I'm not sure what to do. The replies method also isn't documented unfortunately.
Don't worry about it, working with the reddit API has more than trained me to deal with vagueness and inconsistency :wink:. After doing some research, this may be a combination of issues on both reddit's and my end.
Temporary Fix (?)
Could you try comment.reload and then see if that loads the comments? If it does, I can be sure that the issue is what I think it is. Thanks a lot for your help!
Details
I'll describe this in intense detail to help anyone in the future struggling with this obscure aspect of the reddit API.
All comment (t1) objects have an attribute called replies. If the comment has replies, it's a Listing. If the comment has no replies or if the replies aren't included in this response (like from a /api/info call) the replies key is an empty string, instead of an empty listing or just null like a sane API. Reddit's mobile website does a sort of check as well (commentTreeUtils.js).
Redd assumed that an empty string meant no comments, which is clearly incorrect.
- see reddit/reddit#662
- see https://redd.it/17s9l4
reload works! Thanks so much.
That's a relief! I'll leave this open until I release a more substantial fix.
Hi @avinashbot, any updates on this? I'm having a similar issue on master and reloading the comment doesn't fix it.