/// <inheritdoc/> protected override async Task OnFirstAfterRenderAsync() { dotNetObjectRef ??= CreateDotNetObjectRef(new BreakpointActivatorAdapter(this)); await JSBreakpointModule.RegisterBreakpoint(dotNetObjectRef, ElementId); if (Mode != BarMode.Horizontal) { // Check if we need to collapse the Bar based on the current screen width against the breakpoint defined for this component. // This needs to be run to set the initial state, RegisterBreakpointComponent and OnBreakpoint will handle // additional changes to responsive breakpoints from there. isBroken = BreakpointActivatorAdapter.IsBroken(Breakpoint, await JSBreakpointModule.GetBreakpoint()); if (isBroken) { initial = false; await Toggle(); } else if (initial) { initial = false; DirtyClasses(); await InvokeAsync(StateHasChanged); } } await base.OnFirstAfterRenderAsync(); }
/// <inheritdoc/> protected override async ValueTask DisposeAsync(bool disposing) { if (disposing) { // make sure to unregister listener if (Rendered) { var task = JSBreakpointModule.UnregisterBreakpoint(this); try { await task; } catch when(task.IsCanceled) { }