Uncaught TypeError: Cannot read property 'option' of undefined (when saving statements)
Closed, ResolvedPublic

Description

sometimes when saving statements on test.wikidata, I get a js error:

jquery.wikibase.edittoolbar.js?645d4:363 Uncaught TypeError: Cannot read property 'option' of undefined

the error comes from:

subToolbar.option( '$content', this.getButton( 'edit' ).element );

in:

	/**
	 * Switches the toolbar to non-edit mode displaying the "edit" button.
	 */
	toNonEditMode: function() {
		if ( !this._isInEditMode() ) {
			return;
		}

		if ( this._$tooltipAnchor ) {
			this._$tooltipAnchor.detach();
		}

		var $subToolbar = this.getContainer().children( ':wikibase-toolbar' ),
			subToolbar = $subToolbar.data( 'toolbar' );

		subToolbar.option( '$content', this.getButton( 'edit' ).element );

		this.getContainer().removeClass( this.widgetBaseClass + '-ineditmode' );
	},
aude created this task.Aug 3 2016, 12:56 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 3 2016, 12:56 AM
Jonas added a subscriber: Jonas.Aug 3 2016, 8:26 AM

Mh not sure if this is a new error. It seems like this part of the code hasn't been touched in years.
Maybe @thiemowmde has an idea.

Change 302709 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Fix TypeError due to race condition in edittoolbar

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

thiemowmde triaged this task as Normal priority.
thiemowmde moved this task from incoming to in progress on the Wikidata board.
thiemowmde moved this task from Proposed to Review on the Wikidata-Sprint-2016-08-02 board.
Jonas moved this task from Review to Done on the Wikidata-Sprint-2016-08-02 board.Aug 3 2016, 2:53 PM
Jonas closed this task as Resolved.

Change 302709 merged by jenkins-bot:
Fix TypeError due to race condition in edittoolbar

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

Change 302716 had a related patch set uploaded (by Aude):
Fix TypeError due to race condition in edittoolbar

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

Change 302716 merged by jenkins-bot:
Fix TypeError due to race condition in edittoolbar

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