Skip to content

<Suspense> panic only in release mode, only on Firefox #4546

@tannerntannern

Description

@tannerntannern

I'm following the bug report template for discoverability, but please note that I also created a minimum reproducible example repository here: https://github.com/tannerntannern/leptos-firefox-bug-reprex

Describe the bug

<Suspense> within <details> element causes panic only in release mode, and only on Firefox (latest version). The <details> element might not be the root cause, but it's unclear to me what is.

Code snippets

Dependencies
# common
leptos = { version = "0.8.15", features = ["tracing"] }

# frontend only
console_error_panic_hook = { version = "0.1.7", optional = true }
wasm-bindgen = { version = "=0.2.106", optional = true }

# backend only
axum = { version = "0.8.8", optional = true }
leptos_axum = { version = "0.8.7", features = ["tracing"], optional = true }
tokio = { version = "1", features = ["full"], optional = true }
App component
#[component]
pub fn App() -> impl IntoView {
    let data_resource = OnceResource::new(get_data());
    view! {
        <details open>
            <summary>"Server Data"</summary>
            <Suspense fallback=move || view! { <div>"Loading data"</div> }>
                {move || Suspend::new(async move {
                    let data = data_resource.await.unwrap();
                    view! {
                        "Data: "{data}
                    }
                })}
            </Suspense>
        </details>
    }
}

#[server]
async fn get_data() -> Result<String, ServerFnError> {
    Ok("abc123".to_string())
}

To Reproduce

  1. Install cargo-leptos version 0.3.2
  2. Run cargo leptos watch --release (could not reproduce in debug mode)
  3. Open the app in Firefox for MacOS (tested on latest version; could not reproduce in Chrome or Safari)
  4. Observe following error in the console (behavior is not consistent, might need to refresh a few times)

Error details

You should see something to the effect of

panicked at /Users/tnielsen/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.2.11/src/hydration.rs:227:9:
internal error: entered unreachable code
...

Screenshots

Image

Next Steps

  • I will make a PR
  • I would like to make a PR, but need help getting started
  • I want someone else to take the time to fix this
  • This is a low priority for me and is just shared for your information

Additional context

I can make any of the following changes in app.rs and the error goes away:

  • Change the <details> element to a <div>
  • Remove the outer <details> element entirely
  • Change the Suspense fallback to move || "Loading data" (from move || view! { <div>"Loading data"</div> })

Also mentioned above, but I cannot reproduce in any browser except Firefox. I can only reproduce in release mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions