Hi,
I think the problem is when the Configuration page can actually get at its persisted state compared to when it runs this line:
TabId ??= CascadedTabId;
In my set up of your code, CascadedTabId seemed to get set in a split second and then return to null shortly after.
- On full refresh of
/admin/configure- The interactive
Configurationcomponent starts up in a context where[PersistentState]can restoreTabId. - So
TabIdis already set from persistence whenOnInitializedAsyncruns, andTabId ??= CascadedTabId;effectively does nothing. - That’s why you see the same
TabIdasGlobalMessagesAreaafter a hard refresh.
- The interactive
- On enhanced navigation to
/admin/configure- The interactive page instance is created in a different pipeline: at that point, the persisted state for this page is not available (or not wired up yet).
-
CascadedTabIdis also not usable in this phase for the interactive page. - So when
OnInitializedAsyncruns: -
TabIdis still unset (persistence hasn’t provided anything), -
CascadedTabIdis effectively not giving you a usable value, - Result:
TabIdnever gets a value at all on that navigation.
So, in short: Configuration.razor initializes [PersistentState] in OnInitializedAsync on an InteractiveServer page, but under enhanced navigation the interactive instance can’t see its persisted TabId (and doesn’t get a usable cascaded tabId either) at that point. On full refresh the persisted value is available in time, so TabId matches GlobalMessagesArea; on enhanced navigation it isn’t, so TabId ends up empty.
You need to tackle handling CascadedTabId differently