Page MenuHomePhabricator

[Pre-deployment testing] Getting error " Uncaught TypeError: Cannot read property 'then' of undefined" while replying to a nested reply
Closed, ResolvedPublic

Description

Getting error " Uncaught TypeError: Cannot read property 'then' of undefined" while replying to a nested reply.

Steps to reproduce:

  1. Go here: http://visualeditor-prototype.wmflabs.org/wiki/Talk:Reply_test#testing_this_chronology_business
  1. Click on the reply link next to a nested reply e.g. Reply 2

Observed Result:
Nothing happens, there is an error in the console.

Screen Shot 2019-12-04 at 1.30.45 PM.png (495×1 px, 143 KB)

Event Timeline

ppelberg added subscribers: Enterprisey, TheDJ.

Provisionally merging T239861 in as a duplicate of this task. Per our discussion in today's stand: let's see if resolving this task (T239864) also takes care of T239861.

I figured out why this happens:

  • The error message indicates the exception is thrown by onReplyClick because this.comment.parsoidPromise is not set.
  • That property is set in init and there's no way in which it wouldn't be set… unless the code crashed before that point.
  • After looking at the screenshot again a couple times, I noticed that there's a yellow "warning" before the red "error" in the console – we only see the last lines of it, but that's clearly an error backtrace, and it's in yellow instead of red because it was thrown (and caught) in a jQuery Deferred.
  • Then I looked at the screenshot in T239865 and realized that's probably the same error there. It happens when we try to call highlight without specifying the comment to highlight.
  • Apparently that happens when you're not logged in – the code to highlight your latest comment has a bug and it can't find comments by anonymous users.

This will be fixed by the changes in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/552664. In the meantime, log in before testing DiscussionTools :)

This seems to be working now for me.

matmarex claimed this task.