@inject BrowserBridge Browser

@code {
    [Parameter]
    public string? Page { get; set; }

    [Parameter]
    public string? BodyClass { get; set; }

    private string? _lastSignature;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await Browser.StartViewportAsync();
        }

        var signature = $"{Page ?? string.Empty}|{BodyClass ?? string.Empty}";
        if (signature == _lastSignature)
        {
            return;
        }

        _lastSignature = signature;
        await Browser.SetBodyStateAsync(Page, BodyClass);
    }
}
