fix(core-app): CB-2190 node parent id detection

This commit is contained in:
Wroud
2022-07-08 13:48:01 +03:00
parent 65071da7f0
commit dbff82bed5
2 changed files with 12 additions and 4 deletions
@@ -129,11 +129,11 @@ export class NavNodeInfoResource extends CachedMapResource<string, NavNode> {
return this.data;
}
navNodeInfoToNavNode(node: NavNodeInfo, parentId?: string): NavNode {
navNodeInfoToNavNode(node: NavNodeInfo, parentId?: string, requestPath?: string): NavNode {
return {
...node,
objectFeatures: node.object?.features || [],
parentId: parentId || this.get(node.id)?.parentId || ROOT_NODE_PATH,
parentId: parentId ?? this.get(node.id)?.parentId ?? requestPath ?? ROOT_NODE_PATH,
};
}
@@ -512,7 +512,11 @@ export class NavTreeResource extends CachedMapResource<string, string[]> {
...data.map(data => data.parentPath),
...data.map(data => data.navNodeChildren.map(node => node.id)).flat(),
]), [
...data.map(data => this.navNodeInfoResource.navNodeInfoToNavNode(data.navNodeInfo)).flat(),
...data.map(data => this.navNodeInfoResource.navNodeInfoToNavNode(
data.navNodeInfo,
undefined,
data.parentPath
)).flat(),
...data.map(
data => data.navNodeChildren.map(
node => this.navNodeInfoResource.navNodeInfoToNavNode(node, data.parentPath)
@@ -537,7 +541,11 @@ export class NavTreeResource extends CachedMapResource<string, string[]> {
data.parentPath,
...data.navNodeChildren.map(node => node.id),
]), [
this.navNodeInfoResource.navNodeInfoToNavNode(data.navNodeInfo),
this.navNodeInfoResource.navNodeInfoToNavNode(
data.navNodeInfo,
undefined,
data.parentPath
),
...data.navNodeChildren.map(node => this.navNodeInfoResource.navNodeInfoToNavNode(node, data.parentPath)),
]
);