fix(core): nav tree error handling

This commit is contained in:
Wroud
2020-06-12 12:28:13 +03:00
parent 2abe3c86cf
commit 35988cbbc7
@@ -44,6 +44,7 @@ export function useNavigationTree(nodeId: string, parentId: string) {
const state = await navigationTreeService.loadNestedNodes(nodeId);
if (!state) {
switchExpand(false);
return;
}
}
switchExpand(!isExpanded);
@@ -70,7 +71,9 @@ export function useNavigationTree(nodeId: string, parentId: string) {
useEffect(() => {
if (isExpanded && !children.isLoaded && !children.isLoading && !!children.children && nodeLoaded) {
navigationTreeService.loadNestedNodes(nodeId);
navigationTreeService
.loadNestedNodes(nodeId)
.then(state => !state && switchExpand(false));
}
}, [isExpanded, children.isLoaded, children.isLoading, children.children, nodeLoaded, nodeId]);