Repository navigation
Updates navigation node commands navigation/menuState API. Closes #7617 - #7625
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The remove command remains on the old API, and set-command interactive validation lacks required option-set metadata.
2 open findings
What changed in this PR
Migrates SharePoint navigation node add, get, and set commands to the MenuState API and aligns their schemas, output, tests, and documentation.
Changes:
- Adds shared recursive MenuState node lookup.
- Migrates commands to MenuState and Zod validation.
- Updates tests and documentation for the new API shape.
| File | Description |
|---|---|
src/utils/spo.ts |
Adds MenuState node lookup helpers. |
src/utils/spo.spec.ts |
Tests recursive node lookup. |
NavigationNode.ts |
Updates MenuState node types. |
navigation-node-add.ts |
Migrates node creation to MenuState. |
navigation-node-add.spec.ts |
Tests new add behavior. |
navigation-node-get.ts |
Retrieves nodes through MenuState. |
navigation-node-get.spec.ts |
Tests location-specific retrieval. |
navigation-node-set.ts |
Updates nodes through MenuState. |
navigation-node-set.spec.ts |
Tests updated properties and validation. |
navigation-node-add.mdx |
Documents revised options and output. |
navigation-node-get.mdx |
Documents MenuState output. |
navigation-node-set.mdx |
Documents location and revised updates. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
milanholemans
left a comment
There was a problem hiding this comment.
Looks almost good to go, got one remark, also Copilot found a valid remark.
| if (title !== undefined) { | ||
| node.Title = title; | ||
| } | ||
|
|
||
| const requestBody: any = { | ||
| Title: args.options.title, | ||
| IsExternal: args.options.isExternal, | ||
| Url: url | ||
| }; | ||
|
|
||
| if (args.options.audienceIds !== undefined) { | ||
| requestBody.AudienceIds = args.options.audienceIds === '' ? [] : args.options.audienceIds.split(','); | ||
| if (url !== undefined) { | ||
| node.SimpleUrl = url; | ||
| } |
There was a problem hiding this comment.
Instead of putting it into conditions, can't we just assign it directly to the object? If the option is undefined, it will not be included in the request body anyway.
There was a problem hiding this comment.
I believe no. What we do is retrieve the full node from getMenuStateNodeByKey, then update what changed ans send it back using saveMenuState. If we set it to undefined and send this back I think it will clear the URL value of the menu option
There was a problem hiding this comment.
Yeah, I was mistaken; I thought it was the add command.
|
@milanholemans can you recheck |

Closes #7617