jenkins-bot has submitted this change and it was merged.

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, 8 insertions(+), 7 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/view/resources/jquery/wikibase/snakview/snakview.js 
b/view/resources/jquery/wikibase/snakview/snakview.js
index 3d50010..edd697e 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,14 @@
                        $( '<div/>' ).append( $( '<span/>' ).addClass( 
'mw-small-spinner' ) )
                );
 
+               // The "value" variation contains experts that depend on the 
property and value type. Must
+               // be recreated when the property changes. Would be better to 
do this in updateVariation,
+               // and only when the 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: merged
Gerrit-Change-Id: Ic4939b20f012feb62a917c4e2257f8e78ef426ad
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to