-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
I somehow got into a state where Blazor's runtime metric says I have no active circuits, even though I still have a working Counter page:

Here's my Counter.razor:
@page "/counter"
@rendermode InteractiveServer
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @CurrentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
[PersistentState]
public int CurrentCount { get; set; }
private void IncrementCount()
{
CurrentCount++;
}
}
I added a simple script in App.razor to pause and resume circuits based on visibility:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<ResourcePreloader />
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
<link rel="stylesheet" href="@Assets["app.css"]" />
<link rel="stylesheet" href="@Assets["BlazorIdentityTest3.styles.css"]" />
<ImportMap />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>
<body>
<Routes />
<ReconnectModal />
<script src="@Assets["_framework/blazor.web.js"]"></script>
<script src="@Assets["Components/Account/Shared/PasskeySubmit.razor.js"]" type="module"></script>
<script>
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
Blazor.pauseCircuit();
} else {
Blazor.resumeCircuit();
}
});
</script>
</body>
</html>
.NET 10 SDK: 10.0.100-rc.1.25451.107
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components