Santhosh has uploaded a new change for review.

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

Change subject: Suggestions: Remove items after the new set arrived.
......................................................................

Suggestions: Remove items after the new set arrived.

Change-Id: I3616c09f70da34b512f50a373f975dc2c6e25119
---
M modules/dashboard/ext.cx.suggestionlist.js
1 file changed, 9 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/42/251142/1

diff --git a/modules/dashboard/ext.cx.suggestionlist.js 
b/modules/dashboard/ext.cx.suggestionlist.js
index 9237093..f46e149 100644
--- a/modules/dashboard/ext.cx.suggestionlist.js
+++ b/modules/dashboard/ext.cx.suggestionlist.js
@@ -847,27 +847,27 @@
         * @param {string} listId
         */
        CXSuggestionList.prototype.refreshList = function ( listId ) {
-               var i, suggestion, list = this.lists[ listId ];
+               var i, itemsToRemove = [],
+                       list = this.lists[ listId ];
 
                if ( !list ) {
                        return;
                }
 
                if ( list.suggestions ) {
-                       for ( i = 0; i < list.suggestions.length; i++ ) {
-                               suggestion = list.suggestions[ i ];
-                               suggestion.$element.hide();
-                       }
+                       itemsToRemove = list.suggestions;
                }
                list.suggestions = [];
                // Do not run out of suggestions
                list.seed = parseInt( Math.random() * 10000, 10 );
                list.queryContinue = undefined;
                list.hasMore = true;
-               // FIXME: Till the new items arrive, this list will become 
empty.
-               // May be we need to keep the height of container and show a 
loading
-               // indicator?
-               this.loadItems( list );
+               // Remove the old items.
+               this.loadItems( list ).then( function () {
+                       for ( i = 0; i < itemsToRemove.length; i++ ) {
+                               itemsToRemove[ i ].$element.remove();
+                       }
+               } );
        };
 
        mw.cx.CXSuggestionList = CXSuggestionList;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3616c09f70da34b512f50a373f975dc2c6e25119
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to