diff --git a/src/Bolero/Components.fs b/src/Bolero/Components.fs index c9a26e45..8c943540 100644 --- a/src/Bolero/Components.fs +++ b/src/Bolero/Components.fs @@ -231,22 +231,19 @@ and [] | None -> initModel, [] override this.OnAfterRenderAsync(firstRender) = - if firstRender then - runProgramLoop() - if router.IsSome then - this.NavigationInterception.EnableNavigationInterceptionAsync() - else - Task.CompletedTask - else + task { + if firstRender then + runProgramLoop() + if router.IsSome then + do! this.NavigationInterception.EnableNavigationInterceptionAsync() + match routeHash with - | None -> - Task.CompletedTask + | None -> () | Some h -> routeHash <- None - task { - let! elt = this.JSRuntime.InvokeAsync("document.getElementById", h) - return! elt.InvokeVoidAsync("scrollIntoView") - } + let! elt = this.JSRuntime.InvokeAsync("document.getElementById", h) + return! elt.InvokeVoidAsync("scrollIntoView") + } override this.Render() = view