Skip to content

Commit

Permalink
Bugfix invalid initial root navnode (SAP#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmarkus authored Nov 21, 2019
1 parent 981fe8d commit 5c680c2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/src/utilities/helpers/routing-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ class RoutingHelpersClass {
return lastElement.defaultChildNode;
} else if (children && children.length) {
const rootPath = pathData.navigationPath.length === 1;
if (rootPath) return children[0].pathSegment;
if (rootPath) {
const firstNodeWithPathSegment = children.find(
child => child.pathSegment
);
return (
(firstNodeWithPathSegment && firstNodeWithPathSegment.pathSegment) ||
console.error(
'At least one navigation node in the root hierarchy must have a pathSegment.'
)
);
}
const validChild = children.find(
child =>
child.pathSegment &&
Expand Down
25 changes: 25 additions & 0 deletions docs/navigation-parameters-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,31 @@ Node parameters are all the parameters that can be added to an individual naviga
- **type**: string
- **description**: sets the child node that Luigi activates automatically if the current node has no **viewUrl** defined. Provide **pathSegment** of the child node you want to activate as a string.

<!-- add-attribute:class:warning -->
>**NOTE:** To define a root-level **defaultChildNode** which is different than the first header navigation node, set an object with **defaultChildNode** and **children** set to `navigation.nodes` instead of an array of nodes.
- **example**:
```javascript
settings: {
navigation: {
nodes: {
defaultChildNode: 'overview',
children: [
{
pathSegment: 'docs',
label: 'Documentation',
viewUrl: '...'
},
{
pathSegment: 'overview',
label: 'Overview',
viewUrl: '...'
}
]
}
}
```
### isolateView
- **type**: boolean
- **description**: renders the view in a new frame when you enter and leave the node. This setting overrides the same-domain frame re-usage. The **isolateView** is disabled by default.
Expand Down

0 comments on commit 5c680c2

Please sign in to comment.