-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I need to have some state shared across all users/sessions.
I've registered my model:
services.AddSingleton<CustomState>(context =>
{
return context.GetRequiredService<ISharedState>().Observable(() => new CustomState());
});This is in my blazor page:
@inject CustomState _customState
@attribute [Observer]
<button class="btn btn-primary" @onclick="TestFunction">Click me</button>
<p>Shared state: @_customState.Title</p>
[Cortex.Net.Api.Action]
private void TestFunction()
{
_customState.Title = Guid.NewGuid().ToString();
}If I open a single page, the UI updates with the new Guid.
If I open another page, the initial render shows the right Guid. However, if I click the button, I would expect (hope) that both pages get re-rendered.
Is this a supported use-case? How would I achieve this effect?
Metadata
Metadata
Assignees
Labels
No labels