Page MenuHomePhabricator

Undoing a change of group on a reference throws "Uncaught TypeError: Cannot read property 'length' of undefined"
Closed, ResolvedPublic1 Story Points

Description

screenshot

Environment-test,production, beta.

Steps-
1> Open a page with at least three different citations(book, news,journal).
2>select the “basic” citation and use any existing reference. The reference gets added.
3>Now while the reference is still highlighted, select “Basic” citation again. Type some text in “Use this Group” and apply changes.
5>Notice the citation is replaced by the text that was put in the “Use this Group” and is highlighted.
6> Now click to undo at least 2-3 times.
7> Notice now the tools in the editor toolbar behave oddly , for ex- link does not get added,the language text is not highlighted ,lists do not get added.

Same problem was found in Chrome,Safari and FF.See screenshot.

In FF JS Console error is-

TypeError:KeyedNodes is undefined
Error: Unbalanced input passed to document.


Version: unspecified
Severity: major

Attached:

Details

Reference
bz69119

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:35 AM
bzimport set Reference to bz69119.
Swainr created this task.Aug 4 2014, 7:16 PM

(In reply to Ritu Swain from comment #0)

1> Open a page with at least three different citations(book, news,journal).
2>select the “basic” citation and use any existing reference. The reference
gets added.

What? We only have book, news and journal at this point... No basic...

(In reply to Alex Monk from comment #1)

(In reply to Ritu Swain from comment #0)

1> Open a page with at least three different citations(book, news,journal).
2>select the “basic” citation and use any existing reference. The reference
gets added.

What? We only have book, news and journal at this point... No basic...

My apologies for the confusion.Here are the steps-

1> Open a page with at least three different citations(book, news,journal).
2> select to add the “basic” citation and choose to use any existing reference. The reference gets added.
3> Now while the reference is still highlighted, select to add “Basic” citation again. When the dialog opens,type some text in “Use this Group” and apply changes.
5> Notice the citation is replaced by the text that was put in the “Use this Group” and is highlighted.
6> Now click to undo at least 2-3 times.
7> Notice now the tools in the editor toolbar behave oddly , for ex- link does not get added,the language text is not highlighted and lists do not get added.

Is this the same thing?

  • Make a basic reference, apply changes
  • Go back and give it a non-blank group, apply changes
  • Undo a few times
  • Uncaught TypeError: Cannot read property 'length' of undefined

(which is related to but not quite the same as bug 69125)

Swainr added a comment.Aug 5 2014, 3:26 PM

(In reply to Alex Monk from comment #3)

Is this the same thing?

  • Make a basic reference, apply changes
  • Go back and give it a non-blank group, apply changes
  • Undo a few times
  • Uncaught TypeError: Cannot read property 'length' of undefined

(which is related to but not quite the same as bug 69125)

in Chrome JS Console- i get this error

Uncaught TypeError: Cannot read property 'length' of undefined.
Error: Unbalanced input passed to document.

in FF JS Console error is-
TypeError:KeyedNodes is undefined
Error: Unbalanced input passed to document.

after this, the tools in the toolbar when accessed behave weirdly.

Yes, but is that the same issue you were talking about in this bug?

Swainr added a comment.Aug 5 2014, 3:43 PM

yes, it is the same issue.

Seems to be caused by the internal list not being (properly?) updated when undoing a group change (it stores references by group name).

  • Bug 69125 has been marked as a duplicate of this bug. ***
Jdforrester-WMF renamed this task from VisualEditor: Undoing a change of group on a reference throws "Uncaught TypeError: Cannot read property 'length' of undefined" to Undoing a change of group on a reference throws "Uncaught TypeError: Cannot read property 'length' of undefined".Nov 23 2014, 11:10 PM
Jdforrester-WMF set Security to None.
Quiddity added subscribers: Quiddity, Aklapper.

Copy of my description from the merged ^ task, in case it's useful:


At https://en.wikipedia.org/w/index.php?title=Lady_Pink in the first citation, I entered text in the "Use this group" area (thinking/hoping that this would make it a "named reference" (but suspecting it might do the footnote-clustering thing, instead))

that didn't work out as expected, so I tried ctrl-Z to undo, which didn't work at all.
I then tried to edit the reference again, to manually revert, but that wouldn't let me edit it (clicking "foo 1" had no result).

I tried to click "Save" in order to "View changes", but that just triggered console errors.

TypeError: group.keyedNodes[this.referenceModel.getListKey(...)] is undefined     load.php:267:894
TypeError: keyedNodes is undefined      load.php:370:128

(Screenshots are from the successful reproduction of the bug)

I looked at this for a while but it's beyond my knowledge of the DM:
When you edit the reference's group, the reference disappears from the old node group (in InternalList) and reappears in the new node group. But after undoing, it seems to have remained there and not moved back.
I think ve.dm.MWReferenceModel.prototype.updateInternalItem handles it for manual changes, but it is not called on undo.

Change 195901 had a related patch set uploaded (by Alex Monk):
Handle undoing of reference group changes

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

Krenair claimed this task.Mar 11 2015, 8:40 PM

Change 195901 merged by jenkins-bot:
Handle undoing of reference group changes

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

Jdforrester-WMF moved this task from Nominated to Done on the VisualEditor 2014/15 Q3 blockers board.