Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using InteractiveAuto or InteractiveWebAssembly rendermodes causes ecomp<...> to be rendered twice #360

Open
rabejens opened this issue Aug 28, 2024 · 0 comments

Comments

@rabejens
Copy link

rabejens commented Aug 28, 2024

When using the latest version that supports the Blazor render modes, the InteractiveAuto and InteractiveWebAssembly render modes cause content to be rendered twice when an ecomp is used.

Steps to reproduce:

  1. Create a new project with version 0.24.8-beta of Bolero.Templates:
    dotnet new bolero-app --name RenderTwiceBug -r InteractiveAuto -m -ni 
    
  2. In that project, create a new component:
    namespace RenderTwiceBug.Client
    
    open Bolero
    open Bolero.Html
    
    type SomeComponent() =
        inherit ElmishComponent<string, string>()
    
        override _.View model dispatch =
            p {
                text (sprintf "Refresh page to reproduce. Text: %s" model)
            }
  3. In Main.fs, replace view with this:
    let view model dispatch =
        ecomp<SomeComponent, _, _> "Some text" (fun _ -> ()) { attr.empty() }
  4. Run the server component, let it load and sit for about 5 seconds
  5. Refresh the page and wait a couple seconds.

Expectation: The paragraph should only be rendered once.
Actual behaviour: The paragraph is rendered a second time after the WebAssembly component had loaded.

Followup:

A workaround is to stick the component into a div:

let view model dispatch =
    div { ecomp<SomeComponent, _, _> "Some text" (fun _ -> ()) { attr.empty() } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant