Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/94#discussion_r228904299
  
    --- Diff: 
ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
 ---
    @@ -30,15 +47,43 @@ export function catalogSelectorDirective() {
             scope: {
                 family: '<',
                 onSelect: '&',
    -            itemsPerPage: '<',
    +            rowsPerPage: '<',  // if unset then fill
                 reservedKeys: '<?',
    +            state: '<?',
                 mode: '@?',  // for use by downstream projects to pass in 
special modes
             },
             template: template,
    -        controller: ['$scope', '$element', '$q', '$uibModal', '$log', 
'$templateCache', 'paletteApi', 'paletteDragAndDropService', 'iconGenerator', 
'composerOverrides', controller]
    +        controller: ['$scope', '$element', '$timeout', '$q', '$uibModal', 
'$log', '$templateCache', 'paletteApi', 'paletteDragAndDropService', 
'iconGenerator', 'composerOverrides', 'recentlyUsedService', controller],
    +        link: link,
         };
     }
     
    +function link($scope, $element, attrs, controller) {
    +    let main = 
angular.element($element[0].querySelector(".catalog-palette-main"));
    +
    +    // repaginate when load completes (and items are shown), or it is 
resized
    +    $scope.$watchGroup(
    +        [ () => $scope.isLoading, () => main[0].offsetHeight, () => 
$scope.state.viewMode.itemsPerRow ],
    +        (values) => controller.$timeout( () => repaginate($scope, 
$element) ) );
    --- End diff --
    
    Instead of using `$timeout`, you should use `$scope.$applyAsync`
    
    ```suggestion
            (values) => $scope.$applyAsync( () => repaginate($scope, $element) 
) );
    ```


---

Reply via email to