You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using dioxus main with the repro app below, in release mode I encounter a panic (two actually), and in debug mode I get a warning (the same one twice in a row actually). It seems to be related to ReadOnlySignals and their subscriptions, but the context is unclear to me, other than it seems to come from a use_effect I am doing. The panic does not come from my code, it comes from dioxus' ReactiveContext, and then from wasm-bindgen-futures. There is a single line in the use_effect that if removed, the panics go away (it is identified with a comment in the code) -- but the warnings remain (even if the entire use_effect is removed, so perhaps these are actually 2 separate things?...). Thankfully, for the moment, I can remove the panic-ing line in my production application to get unblocked on my end, but this still seems like a bug (or two) that needs fixing.
The context:
I have a tree menu component that has expandable items that are all links to other views with the same tree menu. In debug mode via dx serve I get this warning (twice in a row) whenever clicking the links:
WARN /home/chris/git/dioxus/packages/signals/src/warnings.rs:62 Write on signal at /home/chris/git/dioxus/packages/signals/src/read_only_signal.rs:55:24 happened while a component was running. Writing to signals during a render can cause infinite rerenders when you read the same signal in the component. Consider writing to the signal in an effect, future, or event handler if possible.
This is the warning I mentioned in a different PR for a possibly different bug: #3173 (comment) (but maybe related?)
In release mode dx serve --release I get 2 panics back-to-back when clicking the links -- but only under certain circumstances, explained in Reproduction steps below. First panic:
panicked at /home/chris/git/dioxus/packages/core/src/reactive_context.rs:147:62:
called `Result::unwrap()` on an `Err` value: Dropped(ValueDroppedError)
Stack:
__wbg_get_imports/imports.wbg.__wbg_new_abda76e883ba8a5f/<@http://localhost:8080/assets/dioxus/demo2.js:392:21
logError@http://localhost:8080/assets/dioxus/demo2.js:241:18
__wbg_get_imports/imports.wbg.__wbg_new_abda76e883ba8a5f@http://localhost:8080/assets/dioxus/demo2.js:391:66
demo2-8e0046f438d56e3b.wasm.console_error_panic_hook::hook::h4548cbe81c0e9b7e@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[578]:0x67cb7
demo2-8e0046f438d56e3b.wasm.core::ops::function::Fn::call::h909969a68f80df5b@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[2495]:0xa56a3
demo2-8e0046f438d56e3b.wasm.std::panicking::rust_panic_with_hook::h6731baa78621a747@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[956]:0x896b6
demo2-8e0046f438d56e3b.wasm.std::panicking::begin_panic_handler::{{closure}}::hb6cd8464ed39ae71@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1153]:0x92e4c
demo2-8e0046f438d56e3b.wasm.std::sys_common::backtrace::__rust_end_short_backtrace::hbdf3ddeb21a1e747@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[2490]:0xa5677
demo2-8e0046f438d56e3b.wasm.rust_begin_unwind@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1622]:0x9f381
demo2-8e0046f438d56e3b.wasm.core::panicking::panic_fmt::h5c7ce52813e94bcd@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1676]:0xa0073
demo2-8e0046f438d56e3b.wasm.core::result::unwrap_failed::h4ed86702351a3017@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1257]:0x96c58
demo2-8e0046f438d56e3b.wasm.dioxus_core::reactive_context::ReactiveContext::clear_subscribers::h2ab5ee23433423fc@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[414]:0x4e03d
demo2-8e0046f438d56e3b.wasm.core::ops::function::FnOnce::call_once{{vtable.shim}}::hf552881a2025cbfe@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1431]:0x9b86d
demo2-8e0046f438d56e3b.wasm.dioxus_core::virtual_dom::VirtualDom::poll_tasks::h9cfa2ed97f0f6c4c@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[247]:0x16b3e
demo2-8e0046f438d56e3b.wasm.dioxus_core::virtual_dom::VirtualDom::process_events::hf08c276613408e47@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[473]:0x5856f
demo2-8e0046f438d56e3b.wasm.<futures_util::future::future::fuse::Fuse<Fut> as core::future::future::Future>::poll::hac0d4ba5a26185d4@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[284]:0x2b9c3
demo2-8e0046f438d56e3b.wasm.dioxus_web::run::{{closure}}::{{closure}}::{{closure}}::h25b19aaccbebccc0@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1770]:0xa1519
demo2-8e0046f438d56e3b.wasm.<futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h8422edb69cf558c1@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[923]:0x877c9
demo2-8e0046f438d56e3b.wasm.dioxus_web::launch::launch_virtual_dom::{{closure}}::hf3737deb975f0031@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[475]:0x58b67
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::QueueState::run_all::h7d9132dd99889989@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[637]:0x6f292
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::Queue::new::{{closure}}::hbd0c17c08f58ef19@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1888]:0xa27d5
demo2-8e0046f438d56e3b.wasm.<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::he47f03527abc9bfa@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1887]:0xa27c7
__wbg_adapter_57@http://localhost:8080/assets/dioxus/demo2.js:286:10
real@http://localhost:8080/assets/dioxus/demo2.js:224:20
VoidFunction*__wbg_get_imports/imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73/<@http://localhost:8080/assets/dioxus/demo2.js:584:23
logError@http://localhost:8080/assets/dioxus/demo2.js:241:18
__wbg_get_imports/imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73@http://localhost:8080/assets/dioxus/demo2.js:583:77
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::Queue::schedule_task::h821f83eb5f7e7e63@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1064]:0x8ed26
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::task::singlethread::Task::into_raw_waker::raw_wake::h86c70dd49434758e@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1169]:0x9382b
demo2-8e0046f438d56e3b.wasm.futures_core::task::__internal::atomic_waker::AtomicWaker::wake::h8de1cd0b5c729b3c@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1584]:0x9e974
demo2-8e0046f438d56e3b.wasm.dioxus_core::reactive_context::ReactiveContext::new_for_scope::{{closure}}::ha3ff213d0e9b160f@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[570]:0x66cce
demo2-8e0046f438d56e3b.wasm.dioxus_core::reactive_context::ReactiveContext::mark_dirty::h34e77ea34bb2c7a2@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[961]:0x89b11
demo2-8e0046f438d56e3b.wasm.dioxus_router::contexts::router::RouterContext::change_route::hdfee564ef807ef90@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[299]:0x3157a
demo2-8e0046f438d56e3b.wasm.dioxus_router::contexts::router::RouterContext::push_any::h2eea6d4cc0393079@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[649]:0x708ee
demo2-8e0046f438d56e3b.wasm.dioxus_core::events::Callback<Args,Ret>::new::{{closure}}::hebd3909b5bc9c9ff@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[491]:0x5b410
demo2-8e0046f438d56e3b.wasm.dioxus_core::events::Callback<Args,Ret>::call::h0486a4a496ee56b4@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[746]:0x7a47f
demo2-8e0046f438d56e3b.wasm.dioxus_core::events::Callback<Args,Ret>::leak::{{closure}}::h0281c5afd1516b4e@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[628]:0x6e11d
demo2-8e0046f438d56e3b.wasm.dioxus_core::runtime::Runtime::with_scope_on_stack::hde8e7f89aef6f194@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[926]:0x87a62
demo2-8e0046f438d56e3b.wasm.dioxus_core::events::Callback<Args,Ret>::call::haa490a1f049d579c@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[559]:0x6546f
demo2-8e0046f438d56e3b.wasm.dioxus_core::runtime::Runtime::handle_event::h25942720f1c3db8c@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[237]:0xcb36
demo2-8e0046f438d56e3b.wasm.dioxus_web::dom::WebsysDom::new::{{closure}}::hb9539bc451d374f6@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[341]:0x3de3a
demo2-8e0046f438d56e3b.wasm.<dyn core::ops::function::FnMut<(&A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::hf06d3e17e0deca53@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1639]:0x9f7ad
__wbg_adapter_51@http://localhost:8080/assets/dioxus/demo2.js:271:14
real@http://localhost:8080/assets/dioxus/demo2.js:224:20
EventListener.handleEvent*createListener@http://localhost:8080/assets/dioxus/snippets/dioxus-interpreter-js-d20e126dfa95ef37/inline0.js:2:2051
run@http://localhost:8080/assets/dioxus/snippets/dioxus-interpreter-js-d20e126dfa95ef37/inline0.js:152:18
__wbg_get_imports/imports.wbg.__wbg_run_eaeb4cfa2f7014ad/<@http://localhost:8080/assets/dioxus/demo2.js:615:25
logError@http://localhost:8080/assets/dioxus/demo2.js:241:18
__wbg_get_imports/imports.wbg.__wbg_run_eaeb4cfa2f7014ad@http://localhost:8080/assets/dioxus/demo2.js:614:66
demo2-8e0046f438d56e3b.wasm.dioxus_interpreter_js::unified_bindings::Interpreter::flush::h93b4d26c1a57abb2@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[453]:0x55076
demo2-8e0046f438d56e3b.wasm.dioxus_web::mutations::<impl dioxus_web::dom::WebsysDom>::flush_edits::h8c789f1ff95bef97@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[805]:0x7f322
demo2-8e0046f438d56e3b.wasm.dioxus_web::launch::launch_virtual_dom::{{closure}}::hf3737deb975f0031@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[475]:0x58a97
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::QueueState::run_all::h7d9132dd99889989@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[637]:0x6f292
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::Queue::new::{{closure}}::hbd0c17c08f58ef19@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1888]:0xa27d5
demo2-8e0046f438d56e3b.wasm.<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::he47f03527abc9bfa@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1887]:0xa27c7
__wbg_adapter_57@http://localhost:8080/assets/dioxus/demo2.js:286:10
real@http://localhost:8080/assets/dioxus/demo2.js:224:20
VoidFunction*__wbg_get_imports/imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73/<@http://localhost:8080/assets/dioxus/demo2.js:584:23
logError@http://localhost:8080/assets/dioxus/demo2.js:241:18
__wbg_get_imports/imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73@http://localhost:8080/assets/dioxus/demo2.js:583:77
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::queue::Queue::schedule_task::h821f83eb5f7e7e63@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1064]:0x8ed26
demo2-8e0046f438d56e3b.wasm.wasm_bindgen_futures::task::singlethread::Task::spawn::h0b08115bd32594cb@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1437]:0x9bb10
demo2-8e0046f438d56e3b.wasm.dioxus_web::launch::launch::ha998ef21ff8d1f28@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[419]:0x4ef5e
demo2-8e0046f438d56e3b.wasm.dioxus::launch::launch::hfec61e95285d10a5@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1524]:0x9d800
demo2-8e0046f438d56e3b.wasm.demo2::main::hb5fe6fce38e439fb@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1661]:0x9fcc0
demo2-8e0046f438d56e3b.wasm.std::sys_common::backtrace::__rust_begin_short_backtrace::he91b5282dc55fce9@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[2494]:0xa569b
demo2-8e0046f438d56e3b.wasm.std::rt::lang_start::{{closure}}::haf0eb5d5b3d0b538@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[2281]:0xa4c89
demo2-8e0046f438d56e3b.wasm.std::rt::lang_start_internal::hec97bf45d8a61427@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[895]:0x85beb
demo2-8e0046f438d56e3b.wasm.main@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[1746]:0xa1030
demo2-8e0046f438d56e3b.wasm.@http://localhost:8080/assets/dioxus/demo2_bg.wasm:wasm-function[2279]:0xa4c6d
__wbg_finalize_init@http://localhost:8080/assets/dioxus/demo2.js:1569:10
__wbg_init@http://localhost:8080/assets/dioxus/demo2.js:1621:12
async*@http://localhost:8080/view/3:15:9
In case it was not clear from reading things over: the line that needs to be commented out is intended to have a meaningful impact, and I do want that functionality to work. Specifically, after hitting the plus button to expand all the children for each item, when a link is clicked, I want all the other items children to be closed. Without that line, they all stay open (except the one moved off of). With that line on, in debug mode, it works correctly to close/hide the other items' children, which is behavior I certainly want in release mode -- without panics or warnings ;)
Looking at the logs, I think the panic is caused by the effect trying to rerun after the component has been dropped. We try to prevent that by making sure a scope exists at the slot before running the component, but the reproduction causes the same slot to be reallocated in the same frame. This is a similar issue to #2488 and can be fixed by switching from index ids to generational indexes or just removing any queued effects as we remove the scope
Problem
Using dioxus main with the repro app below, in release mode I encounter a panic (two actually), and in debug mode I get a warning (the same one twice in a row actually). It seems to be related to
ReadOnlySignal
s and their subscriptions, but the context is unclear to me, other than it seems to come from ause_effect
I am doing. The panic does not come from my code, it comes from dioxus' ReactiveContext, and then from wasm-bindgen-futures. There is a single line in the use_effect that if removed, the panics go away (it is identified with a comment in the code) -- but the warnings remain (even if the entire use_effect is removed, so perhaps these are actually 2 separate things?...). Thankfully, for the moment, I can remove the panic-ing line in my production application to get unblocked on my end, but this still seems like a bug (or two) that needs fixing.The context:
I have a tree menu component that has expandable items that are all links to other views with the same tree menu. In debug mode via
dx serve
I get this warning (twice in a row) whenever clicking the links:This is the warning I mentioned in a different PR for a possibly different bug: #3173 (comment) (but maybe related?)
In release mode
dx serve --release
I get 2 panics back-to-back when clicking the links -- but only under certain circumstances, explained in Reproduction steps below. First panic:Second panic:
Repro app:
Steps To Reproduce
dx serve --release
, then open http://localhost:8080 and click on 2, to open its viewExpected behavior
Don't panic
And I'd like the warnings to go away in debug mode as well as those seem very suspicious, whether related to the panics or not.
Environment:
Questionnaire
I'm interested in fixing this myself but don't know where to start
Thanks
The text was updated successfully, but these errors were encountered: