Skip to content

Commit

Permalink
Merge pull request #3108 from guardian/fix-new-collection-not-appearing
Browse files Browse the repository at this point in the history
Adds watch to node children, to update if new collections are added
  • Loading branch information
SHession authored Jan 19, 2021
2 parents 29585c6 + 05c8c44 commit 481f492
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ grCollectionsPanel.controller('GrNodeCtrl',
const pathId = ctrl.node.data.data.pathId;

//This filter remove child nodes with missing data, preventing display errors from occurring
ctrl.children = ctrl.node.data.children.filter(node => !!node.data.data);
ctrl.filterChildren = children => children.filter(node => !!node.data.data);

ctrl.children = ctrl.filterChildren(ctrl.node.data.children);
$scope.$watch('ctrl.node.data.children', children => {
ctrl.children = ctrl.filterChildren(children);
});

ctrl.saving = false;
ctrl.removing = false;
Expand All @@ -123,7 +128,7 @@ grCollectionsPanel.controller('GrNodeCtrl',
ctrl.getCollectionQuery = path => getCollection(path);

$scope.$watch('ctrl.showChildren', onValChange(show => {
collectionsTreeState.setState(pathId, show);
collectionsTreeState.setState(pathId, show);
}));

ctrl.init = function(grCollectionTreeCtrl) {
Expand Down

0 comments on commit 481f492

Please sign in to comment.