-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
closure invoked recursively or after being dropped #2882
Comments
Apparently, it's in this function:
I read that there may be a missing |
I cannot reproduce the issue with this code: [dependencies]
dioxus = { version = "0.5", features = ["fullstack"] }
[features]
web = ["dioxus/web"]
server = ["dioxus/axum"] main.rs use dioxus::prelude::*;
fn main() {
launch(App);
}
#[component]
fn App() -> Element {
rsx! {
MySection {
url: "https://www.google.com".to_string()
}
}
}
#[server]
pub(crate) async fn test() -> Result<Vec<u8>, ServerFnError> {
Ok(vec![])
}
#[component]
pub fn MySection(url: String) -> Element {
let ret = use_resource(move || async move { test().await });
rsx! {
match &*ret.read() {
Some(Ok(_)) =>
rsx! {
"OK"
},
Some(Err(e)) => rsx! { p { "Loading failed, {e}" } },
None => rsx! { p { "Loading..." } },
}
}
} |
We use several web-sys closures in dioxus-web. If you are interested in debugging this issue, you can try to track down which closure is causing issues by adding dioxus-logger and adding logs to each closure passed to javascript in dioxus-web |
@ealmloff : Yes I will check that in the next hours ! |
I can’t reproduce this either 🤔 do you have any other errors in the console above that? I think it’s somewhat of a known issue that |
Well, I changed the code for some inputs and now it's impossible to reproduce. I will close for now, but if it appears again, I will reopen. Thanks guys |
I ran into this, seems to be (in my case) caused by two event handlers firing: removing the use dioxus::{prelude::*, web::WebEventExt};
use dioxus_logger::tracing::{debug, Level};
use wasm_bindgen::JsCast;
use web_sys::HtmlInputElement;
fn main() {
dioxus_logger::init(Level::DEBUG).expect("failed to init logger");
dioxus::launch(App);
}
#[component]
fn App() -> Element {
let mut input_el: Signal<Option<HtmlInputElement>> = use_signal(|| None);
rsx! {
div {
style: "width: 100vw; height:100vh; background-color: lime;",
onclick: move |_ev| {
if let Some(input_el) = input_el.as_ref() {
input_el.focus().ok();
}
},
input {
onmounted: move |ev| {
let el = ev.as_web_event();
if let Ok(el) = el.dyn_into::<HtmlInputElement>() {
input_el.set(Some(el))
}
},
onfocus: move |_ev| {
debug!("search::focus");
},
}
}
}
} [package]
name = "crash"
version = "0.1.0"
authors = ["spookyvision"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus = { version = "0.6.0", features = [] }
dioxus-logger = "0.6.0"
wasm-bindgen = "0.2.99"
web-sys = { version = "0.3.76", features = ["Element", "HtmlInputElement"] }
[features]
default = ["web"]
web = ["dioxus/web"]
desktop = ["dioxus/desktop"]
mobile = ["dioxus/mobile"]
[profile]
[profile.wasm-dev]
inherits = "dev"
opt-level = 1
[profile.server-dev]
inherits = "dev"
[profile.android-dev]
inherits = "dev" |
Thanks for creating a reproduction. I reproduce the panic on MacOs in chrome as well |
Hello,
I have an issue with a simple app, running 0.5.6:
the error, in console (chrome and firefox):
The result is loaded, the page shows "OK" but this error arises in my console log as the last element.
Note: I replaced the app names above.
What is happening ?
How to avoid this ?
Thanks!
The text was updated successfully, but these errors were encountered: