Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Move variation destroying into private method
......................................................................

Move variation destroying into private method

Pure refactoring for readability of the code.

Change-Id: Ic4939b20f012feb62a917c4e2257f8e78ef426ad
---
M view/resources/jquery/wikibase/snakview/snakview.js
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/47/306447/1

diff --git a/view/resources/jquery/wikibase/snakview/snakview.js 
b/view/resources/jquery/wikibase/snakview/snakview.js
index 3d50010..c7358b5 100644
--- a/view/resources/jquery/wikibase/snakview/snakview.js
+++ b/view/resources/jquery/wikibase/snakview/snakview.js
@@ -245,13 +245,6 @@
                        }
                } )
                .on( 'entityselectorselected', function( event, entityId ) {
-                       if ( self._variation ) {
-                               // A new property has been selected:
-                               // Remove the existing variation as it's 
impossible to change
-                               // the property id in the variation and its 
dependencies.
-                               self._variation.destroy();
-                               self._variation = null;
-                       }
                        self._selectProperty();
                } );
        },
@@ -267,6 +260,13 @@
                        $( '<div/>' ).append( $( '<span/>' ).addClass( 
'mw-small-spinner' ) )
                );
 
+               // Would be better to only do this when the property or value 
type changes, but at this
+               // point we can't find out any more.
+               if ( this._variation ) {
+                       this._variation.destroy();
+                       this._variation = null;
+               }
+
                this.updateVariation();
                this.drawSnakTypeSelector();
                this.drawVariation();

-- 
To view, visit https://gerrit.wikimedia.org/r/306447
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4939b20f012feb62a917c4e2257f8e78ef426ad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to