Open zakstucke opened 4 hours ago
I have no idea if it's related or separate, but I'm having another similar issue after setting up a blocking resource. I'll add the basics in case it's useful, but don't have a good repro, hopefully fixed by the main repro of this issue above!
I have a simple anchor tag inside a site navbar (this is in an Either::Right(view!{...})
of a reactive block of whether a user is logged in or not, the user being logged in is a blocking resource):
view! {
<a href="/login">"Login"</a>
}
The direct error is:
ERROR:
/Users/zak/z/code/leptos/tachys/src/html/element/mod.rs:353:14
Panic: called `Option::unwrap()` on a `None` value
Looking at the source, I added a print above this line for cursor.current()
to see what it was failing on, it prints "Login", whereas everything else prints an html element, so I think this is why it errors on element extraction here, and how I pinpointed this anchor.
Interestingly, if I change the view to:
view! {
<div>
<a href="/login">"Login"</a>
</div>
}
The error then changes to:
ERROR:
/Users/zak/z/code/leptos/tachys/src/hydration.rs:99:14
Panic: could not convert current node into marker node
If remove the view entirely, so in this case it becomes Either::Right(())
the error goes back to original, but the debug print now prints out "<!----->", so there's clearly some mismatch in the dom.
ERROR:
/Users/zak/z/code/leptos/tachys/src/html/element/mod.rs:353:14
Panic: called `Option::unwrap()` on a `None` value
If this doesn't get solved once this direct repro is and this issue is shut, I'll open a separate issue afterwards, just adding in case it helps.
Describe the bug Scripts seem to be able to break leptos hydration, when used inside a
<Scripts />
tag, errors with the marker node. This repro uses a google analytics script, this just happened to be how I could repro it.Leptos Dependencies Current main.
To Reproduce
I've verified this happens in a fresh project, checked in
counter_isomorphic
, where I had to addleptos_meta
then replace theCounters
component with thisApp
and add<MetaTags />
to the shell inmain.rs
.