fix(core-app): CB-668 navigation tree select & expand behavior

This commit is contained in:
Wroud
2021-03-04 22:40:56 +03:00
parent 91f8d2617e
commit d66228c3d0
2 changed files with 11 additions and 1 deletions
@@ -99,7 +99,12 @@ export function useNavigationNode(node: NavNode): INavigationNode {
if (node && context?.isSelected?.(node)) {
context.onSelect?.(node, true);
}
}, [context, node]);
}, [context, node.id]);
useEffect(() => () => {
// TODO: seems like selection & expand should be specific for separate tree definitions
navigationTreeService.expandNode(node.id, false);
}, [node.id]);
return {
control: context?.control,
@@ -69,6 +69,11 @@ export class NavigationTreeService {
this.navigationTreeMetadata.delete(key);
});
});
this.navTreeResource.onItemDelete.addHandler(key => {
ResourceKeyUtils.forEach(key, key => {
this.expandNode(key, false);
});
});
}
getChildren(id: string): string[] | undefined {