Page MenuHomePhabricator

Trying to re-use a reference replacing itself crashes; should instead be a no-op
Closed, ResolvedPublic1 Estimated Story Points

Description

Steps to reproduce:

  1. Open a page with VE
  2. Insert a Basic Reference

3.Reopen the reference dialog again.
4.Now delete the text from the textfield , this will enable "Use existing reference" button in the dialog
5.Now go ahead and click on that button
6.Select this same reference, which is showing up in the list

Observed Result:
The following error appears in the console:
Uncaught TypeError: Cannot read property 'length' of undefined

Expected Result:
Probably we should not show the same reference in the Use existing reference list while accessing it from that reference dialog ?

Screen_Shot_2015-02-23_at_11.20.33_AM.png (711×1 px, 179 KB)

Event Timeline

Ryasmeen raised the priority of this task from to Needs Triage.
Ryasmeen updated the task description. (Show Details)
Ryasmeen added a project: VisualEditor.
Ryasmeen subscribed.

Or reusing the same reference can cause us to just discard any of your changes and close the reference dialog, since you're saying you want to re-use the existing content? @Jdforrester-WMF, what do you think?

Jdforrester-WMF renamed this task from TypeError "Cannot read property 'length' of undefined" appears while trying to select the same reference from Use Existing Reference dialog to Trying to re-use a reference replacing itself crashes; should instead be a no-op.Sep 15 2015, 6:57 PM
Jdforrester-WMF triaged this task as Low priority.
Jdforrester-WMF set Security to None.
Jdforrester-WMF edited a custom field.

Change 240907 had a related patch set uploaded (by Alex Monk):
Don't error when trying to re-use a reference as itself.

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

(It turns out this bug seems much easier to fix than when I thought about it two months ago. And I'm pretty sure it's my code that broke this, sorry :()

Change 240907 merged by jenkins-bot:
Don't error when trying to re-use a reference as itself.

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