-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
Cannot return <template />
from a component
#64
Comments
"Just doing the Lord's work" 🤣 Leptos already constructs a let template = document.create_element("template");
template.set_inner_html("<template>Just doing the Lord's work.</template>");
let root = template.clone_node_with_deep(true);
let el1 = root.first_child().unwrap_throw(); // panics here It panics because it's trying to iterate over the child nodes and a template element doesn't have child nodes; they live in a document fragment in its I guess the |
Sure! The reason I am using a |
This should now be possible in d4da7e0. The example I used to test it is is pretty cool and shows exactly what a thin layer over the DOM Leptos is providing. You can basically take an |
The following example results in a panic:
This only seems to happen if directly returning a
<template />
from the top level of a component.The full stack trace is:
Also, reading the stack trace, just a heads up, using
unwrap_throw
is unsound as it leads the stack in a potentially non-reentrant state, so if a user catches the JS exception, they will most likely experience UB.The text was updated successfully, but these errors were encountered: