Skip to content

Hydration error when using a button inside a table #3829

Open
@dbdr

Description

@dbdr

Describe the bug

Using the start-axum template and simply placing the button inside a table fails with this error in the browser console:

A hydration error occurred while trying to hydrate an element defined at src/app.rs:62:22.

The framework expected a text node, but found this instead:  <button>

Leptos Dependencies

[dependencies]
leptos = { version = "0.7.0" }
leptos_router = { version = "0.7.0" }
axum = { version = "0.7", optional = true }
console_error_panic_hook = { version = "0.1", optional = true}
leptos_axum = { version = "0.7.0", optional = true }
leptos_meta = { version = "0.7.0" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
wasm-bindgen = { version = "=0.2.100", optional = true }

[features]
hydrate = [
    "leptos/hydrate",
    "dep:console_error_panic_hook",
    "dep:wasm-bindgen",
]
ssr = [
    "dep:axum",
    "dep:tokio",
    "dep:leptos_axum",
    "leptos/ssr",
    "leptos_meta/ssr",
    "leptos_router/ssr",
]

To Reproduce

  1. cargo leptos new --git https://github.com/leptos-rs/start-axum
  2. in src/app.rs, function HomePage, place the button inside a table:
    view! {
        <h1>"Welcome to Leptos!"</h1>
        <table>
            <tr>
                <td>
                    <button on:click=on_click>"Click Me: " {count}</button>
                </td>
            </tr>
        </table>
    }
  1. run cargo leptos watch and open the page in a browser (tried in Firefox).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions