Page MenuHomePhabricator

Categories become "detached item" after clicking 'Cancel' button
Closed, ResolvedPublic1 Estimated Story Points


When following the steps - do not click on 'Apply Changes button'!

  1. In VE-> Categories. Add three categories
  2. Click on the drop-down arrow to delete two of them.
  3. Click 'Cancel'
  4. Re-open the box and one of the categories is still there
  5. Try to delete the remaining category - Uncaught TypeError is displayed:

Error: Cannot remove detached item
remove (undefined, line 380)
(anonymous function) ([native code], line 0)
dispatch (load.php, line 65)
handle (load.php, line 60)

Uncaught TypeError: Cannot read property 'metaItem' of undefined ve.ui.MWCategoryWidget.onRemoveCategoryVM636:7 oo.EventEmitter.emit ve.ui.MWCategoryPopupWidget.onRemoveCategoryVM636:7 oo.EventEmitter.emitOO.ui.ButtonElement.onClickVM636:128 OO.ui.ButtonWidget.onClickload.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=20150218T2…:65 jQuery.event.dispatchload.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=20150218T2…:60 jQuery.event.add.elemData.handle

After clicking the 'Apply button' at any step(even at the last one when it looks like a category cannot be removed), all come back to normal workflow and all categories get deleted.

Event Timeline

Etonkovidova raised the priority of this task from to Medium.
Etonkovidova updated the task description. (Show Details)
Etonkovidova added a project: VisualEditor.
Etonkovidova added a subscriber: Etonkovidova.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 19 2015, 2:03 AM

I can't reproduce step 4 - I reopened the categories dialog, but the categories are still all gone.

Although I can 'Move x category here' on one of the categories which I cancelled addition of, which does error "Uncaught Error: Cannot remove detached item"

Change 193496 had a related patch set uploaded (by Alex Monk):
MWCategoryWidget: Remove entries from this.categories when appropriate

Krenair claimed this task.Feb 27 2015, 10:24 PM
Krenair set Security to None.

Change 193496 merged by jenkins-bot:
MWCategoryWidget: Remove entries from this.categories when appropriate

Verified the fix in beta.

Re-opening: the issue is present in beta, test2, and production - attached the screencast. The issue is not too serious- those 'detached' categories are not saved.

As Alex noticed - re-arranging the categories(dragging them) - and then deleting them causes errors when the Options-Categories dialog is re-opened.

The clarified steps:

  1. Add three categories - AA, BB, CC
  2. Move CC category - insert it in front of BB, then in front of AA (the sequence seems to be important)
  3. Delete AA and BB - click 'Cancel'
  4. Re-open Categories - CC category remains displayed.
  5. Click CC to delete -

Error: Cannot remove detached item
and sometime

TypeError: this.categories[name] is undefined

Etonkovidova reopened this task as Open.Mar 11 2015, 10:59 PM
Etonkovidova removed a project: Verified-in-Phase0.

Marking this issues as 'Closed' again.

The bug about re-arranging categories(drag-and-drop) is opened as "Re-arranged(drag-drop) Categories become "detached item" after clicking 'Cancel' button".

Etonkovidova closed this task as Resolved.Mar 16 2015, 5:48 PM

The bug about re-arranging categories(drag-and-drop) is opened as "Re-arranged(drag-drop) Categories become "detached item" after clicking 'Cancel' button".

Fixed link: T92861