Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Add-PnPNavigationNode in a Hub Site requires manual refresh #2021

Closed
4 tasks
bogeorge opened this issue Apr 13, 2019 · 5 comments
Closed
4 tasks

Add-PnPNavigationNode in a Hub Site requires manual refresh #2021

bogeorge opened this issue Apr 13, 2019 · 5 comments

Comments

@bogeorge
Copy link

###Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:###

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Reporting an issue (or asking a question :))
I first noticed the issue with Apply-PnPProvisioningTemplate but have tried to isolate to the most simplistic example to see what I'm missing or doing wrong.

I'm connected using Connect-PnPOnline to a Hub Site that is set to use the new MegaNav style navigation. I execute the command below

Add-PnPNavigationNode -Location TopNavigationBar -Title "test" -Url "http://www.google.com"

Expected behavior

The node is successfully added to the navigation and it is refreshed.

Actual behavior

The node is successfully added to the navigation but the navigation is not "refreshed". Clicked Edit Nav and then closing without saving makes the new node show.

Steps to reproduce behavior

Use Connect-PnPOnline to connect to a site collection that is both a Hub Site and configured with MegaNav for the navigation

Execute Add-PnpNavigationNode to add a new node to the top navigation bar
for example:
Add-PnPNavigationNode -Location TopNavigationBar -Title "test" -Url "http://www.google.com"

I realize MegaNav is very new, especially when combined with the site being a Hub Site. I'm wondering if there are other calls I need to make to force it to refresh.

Using developer tools I see these api's invoked when you open the nav and close, maybe I can try calling the SaveMenuState but I'll need to generate the object it expects.
/_api/navigation/SaveMenuState
/_api/navigation/menustate

Which version of the PnP-PowerShell Cmdlets are you using?

  • PnP PowerShell for SharePoint 2013
  • PnP PowerShell for SharePoint 2016
  • [x ] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)

How did you install the PnP-PowerShell Cmdlets?

  • [x ] MSI Installed downloaded from GitHub
  • Installed through the PowerShell Gallery with Install-Module
  • Other means
@heinrich-ulbricht
Copy link
Contributor

heinrich-ulbricht commented Apr 17, 2019

I remember reading something about the hub navigation being cached. Editing the entries maybe invalidates the cache. But I don't know details or how to clear this.

But as you say - the API used in the UI looks different from the "classic" SharePoint API. So maybe this is just a bug in the backend.

@bogeorge
Copy link
Author

I was able to reach out to Vesa Juvonen and he confirmed that the navigation is indeed being cached. I did a few tests and found that it seemed to be refreshed between 30 and 60 minutes but that's just a guess since I'm sure many factors affect the timing.

I might be able to invoke /_api/navigation/SaveMenuState to force a refresh but for my needs the wait for the cache to refresh on it's own is perfectly acceptable.

@tshinkle
Copy link

It would be nice to be able to force a refresh. It took about an hour for my mega menu to refresh after updating it with PowerShell. Auto-site provisioning with navigation is being delayed by the inability to perform a refresh.

@nateforsyth
Copy link

I was able to reach out to Vesa Juvonen and he confirmed that the navigation is indeed being cached. I did a few tests and found that it seemed to be refreshed between 30 and 60 minutes but that's just a guess since I'm sure many factors affect the timing.

I might be able to invoke /_api/navigation/SaveMenuState to force a refresh but for my needs the wait for the cache to refresh on it's own is perfectly acceptable.

@bogeorge I don't suppose you can share the comms you had with Vesa please?

We've got a vendor that's struggling to justify a specific tenant that is taking ~4 hours to refresh hub navigation items.

@bogeorge
Copy link
Author

Hey @nateforsyth, Really the main thing I got from Vesa was confirmation that the navigation would refresh from cache on a schedule (typically after 30-60 minutes). I would assume that time could be variable so they may extend that time frame if it's causing too much load or maybe now that Office 365 volume has increased so much.

I noticed that when you edit the nav via the UI it updates right away in my experience so the delay only seems to be related to programmatic updates. In our case we sync navigation from one site to several hubs programmatically in an Azure Function. We have this run on a schedule nightly and so far this has allowed there to be enough time for all the affected hubs to refresh before anyone can get worried.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants