Page MenuHomePhabricator

[Regression pre-wmf.36] Discussion page crashes with error: "ve.init.target.getSaveButtonLabel is not a function" when adding a new section/switching to the whole page editing mode with a draft comment
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. First, make sure you do not have the Quick Topic Adding option enabled on your preferences.
  2. Go to any discussion page, for example: https://en.wikipedia.beta.wmflabs.org/wiki/User_talk:RYasmeen_(WMF)/sandbox
  3. Click on a Reply link and draft a comment.
  4. Without posting the comment, click on the "New Section" link on the top menu

Observed Result:
At this point you will see the progress bar, but it gets stuck and there is this error in the console:

Uncaught TypeError: ve.init.target.getSaveButtonLabel is not a function

Screen Shot 2021-03-24 at 3.59.04 PM.png (1×2 px, 498 KB)

Screen Shot 2021-03-24 at 4.00.14 PM.png (1×2 px, 682 KB)

If you go back to the Read mode now, you will still see the reply tool being open with the draft comment intact, which is expected I guess.

There is another way to reproduce this crash, by clicking on the "Edit Source" link on the top menu in step 4.

In this case as well, the whole page editing mode does not end up loading and you will see the stuck progress bar with the same error in the console.

And if you now go back to the Read mode, you will see this interesting "hybrid" mode:

Screen Shot 2021-03-24 at 4.22.23 PM.png (1×1 px, 528 KB)

Environment: Beta cluster.
Browser: Chrome.

Event Timeline

Ryasmeen renamed this task from Discussion page crashes with error: "ve.init.target.getSaveButtonLabel is not a function" when adding a new section/switching to the whole page editing mode with a draft comment to [Regression pre-wmf.36] Discussion page crashes with error: "ve.init.target.getSaveButtonLabel is not a function" when adding a new section/switching to the whole page editing mode with a draft comment.Mar 24 2021, 11:49 PM

Also, I couldn't reproduce this issue in production, so I am marking it as regression.

@DLynch a question for you about the error @Ryasmeen identified [i]: What – if any – other workflows, beyond the workflow this task is written about, do you think this error could affect [i]?


i. Uncaught TypeError: ve.init.target.getSaveButtonLabel is not a function

This happens because the reply widget opens at the same time as the new wikitext editor (but it's not visible because NWE takes over the whole page), and it overwrites ve.init.target to point to itself, which confuses the editor.

This happens because the reply widget opens at the same time as the new wikitext editor (but it's not visible because NWE takes over the whole page), and it overwrites ve.init.target to point to itself, which confuses the editor.

This context is helpful, @matmarex.

After talking about this with @Ryasmeen some, I've marked this task as "High" priority considering it is preventing a subset of people [i] from being able to access editing.


i. Note: I am assuming the population of people affected by this issue – NWE enabled and New Discussion Tool disabled – to be relatively small.

This happens because the reply widget opens at the same time as the new wikitext editor (but it's not visible because NWE takes over the whole page), and it overwrites ve.init.target to point to itself, which confuses the editor.

This context is helpful, @matmarex.

After talking about this with @Ryasmeen some, I've marked this task as "High" priority considering it is preventing a subset of people [i] from being able to access editing.


i. Note: I am assuming the population of people affected by this issue – NWE enabled and New Discussion Tool disabled – to be relatively small.

Thanks @ppelberg.

Change 675582 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Avoid using global ve.init.target in tools

https://gerrit.wikimedia.org/r/675582

Change 675582 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Avoid using mw.ArticleTarget methods on global ve.init.target in tools

https://gerrit.wikimedia.org/r/675582

The crash is not happening anymore. Thanks @matmarex! :)