Comments (8)
What platform & browser is it broken on? Seems to be working expectedly on my side in Windows + Latest Brave (Chromium).
Edit: It seems like the example breaks down after a few back-and-forward between the list and the news comments page, so that may be the real issue here.
from leptos.
Yeah I think your edited version is correct: if you toggle back and forth between the list and news comments a few times, it breaks.
Here's my readout of the Chrome error message. BorrowMut
is tedious to debug in Wasm devtools, but I suspect I can track this one down eventually.
index-f175fbf7a46f3159_bg.wasm:0x24d9a2 Uncaught RuntimeError: unreachable
at __rust_start_panic (index-f175fbf7a46f3159_bg.wasm:0x24d9a2)
at rust_panic (index-f175fbf7a46f3159_bg.wasm:0x24749e)
at std::panicking::rust_panic_with_hook::h96ef8fe2b738eb24 (index-f175fbf7a46f3159_bg.wasm:0x18fda2)
at std::panicking::begin_panic_handler::{{closure}}::h2012903a365387ff (index-f175fbf7a46f3159_bg.wasm:0x1c03a0)
at std::sys_common::backtrace::__rust_end_short_backtrace::h11a0ade8a412986e (index-f175fbf7a46f3159_bg.wasm:0x24d13c)
at rust_begin_unwind (index-f175fbf7a46f3159_bg.wasm:0x236ae1)
at core::panicking::panic_fmt::h22093794cf4e06c4 (index-f175fbf7a46f3159_bg.wasm:0x2396e1)
at leptos_reactive::signal::SignalId::update::{{closure}}::h1aac7ba71af26a98 (index-f175fbf7a46f3159_bg.wasm:0x1b426a)
at core::option::Option<T>::unwrap_or_else::h987f6c5fd4a3625b (index-f175fbf7a46f3159_bg.wasm:0x171215)
at leptos_reactive::signal::SignalId::update::h262c3b6080138e3e (index-f175fbf7a46f3159_bg.wasm:0x479bc)
$__rust_start_panic @ index-f175fbf7a46f3159_bg.wasm:0x24d9a2
$rust_panic @ index-f175fbf7a46f3159_bg.wasm:0x24749e
$std::panicking::rust_panic_with_hook::h96ef8fe2b738eb24 @ index-f175fbf7a46f3159_bg.wasm:0x18fda2
$std::panicking::begin_panic_handler::{{closure}}::h2012903a365387ff @ index-f175fbf7a46f3159_bg.wasm:0x1c03a0
$std::sys_common::backtrace::__rust_end_short_backtrace::h11a0ade8a412986e @ index-f175fbf7a46f3159_bg.wasm:0x24d13c
$rust_begin_unwind @ index-f175fbf7a46f3159_bg.wasm:0x236ae1
$core::panicking::panic_fmt::h22093794cf4e06c4 @ index-f175fbf7a46f3159_bg.wasm:0x2396e1
$leptos_reactive::signal::SignalId::update::{{closure}}::h1aac7ba71af26a98 @ index-f175fbf7a46f3159_bg.wasm:0x1b426a
$core::option::Option<T>::unwrap_or_else::h987f6c5fd4a3625b @ index-f175fbf7a46f3159_bg.wasm:0x171215
$leptos_reactive::signal::SignalId::update::h262c3b6080138e3e @ index-f175fbf7a46f3159_bg.wasm:0x479bc
$leptos_reactive::signal::WriteSignal<T>::update::h04fa21c128a1a83a @ index-f175fbf7a46f3159_bg.wasm:0x218af2
$leptos_reactive::suspense::SuspenseContext::increment::{{closure}}::h005fb1a7dc1a8609 @ index-f175fbf7a46f3159_bg.wasm:0x24d772
$<T as wasm_bindgen::closure::WasmClosureFnOnce<(),R>>::into_js_function::{{closure}}::h020ddec4077b4b1b @ index-f175fbf7a46f3159_bg.wasm:0xc340a
$<dyn core::ops::function::FnMut<()>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::hfe61989db9ed56f2 @ index-f175fbf7a46f3159_bg.wasm:0x1a4830
__wbg_adapter_29 @ index-f175fbf7a46f3159.js:223
real @ index-f175fbf7a46f3159.js:204
index-f175fbf7a46f3159_bg.wasm:0x18fd9c Uncaught (in promise) RuntimeError: unreachable
at std::panicking::rust_panic_with_hook::h96ef8fe2b738eb24 (index-f175fbf7a46f3159_bg.wasm:0x18fd9c)
at std::panicking::begin_panic_handler::{{closure}}::h2012903a365387ff (index-f175fbf7a46f3159_bg.wasm:0x1c03a0)
at std::sys_common::backtrace::__rust_end_short_backtrace::h11a0ade8a412986e (index-f175fbf7a46f3159_bg.wasm:0x24d13c)
at rust_begin_unwind (index-f175fbf7a46f3159_bg.wasm:0x236ae1)
at core::panicking::panic_fmt::h22093794cf4e06c4 (index-f175fbf7a46f3159_bg.wasm:0x2396e1)
at leptos_reactive::signal::SignalId::update::{{closure}}::h69108e9d271afb40 (index-f175fbf7a46f3159_bg.wasm:0x1b1b90)
at core::option::Option<T>::unwrap_or_else::h3080dcbd20984bf5 (index-f175fbf7a46f3159_bg.wasm:0x16aea7)
at leptos_reactive::signal::SignalId::update::h905d1da9a60ab89e (index-f175fbf7a46f3159_bg.wasm:0x3c64f)
at leptos_reactive::signal::WriteSignal<T>::update::he23bec14327b0e11 (index-f175fbf7a46f3159_bg.wasm:0x1c6a62)
at leptos_reactive::resource::ResourceState<S,T>::load::{{closure}}::h66b14fa4e2722120 (index-f175fbf7a46f3159_bg.wasm:0x91098)
$std::panicking::rust_panic_with_hook::h96ef8fe2b738eb24 @ index-f175fbf7a46f3159_bg.wasm:0x18fd9c
$std::panicking::begin_panic_handler::{{closure}}::h2012903a365387ff @ index-f175fbf7a46f3159_bg.wasm:0x1c03a0
$std::sys_common::backtrace::__rust_end_short_backtrace::h11a0ade8a412986e @ index-f175fbf7a46f3159_bg.wasm:0x24d13c
$rust_begin_unwind @ index-f175fbf7a46f3159_bg.wasm:0x236ae1
$core::panicking::panic_fmt::h22093794cf4e06c4 @ index-f175fbf7a46f3159_bg.wasm:0x2396e1
$leptos_reactive::signal::SignalId::update::{{closure}}::h69108e9d271afb40 @ index-f175fbf7a46f3159_bg.wasm:0x1b1b90
$core::option::Option<T>::unwrap_or_else::h3080dcbd20984bf5 @ index-f175fbf7a46f3159_bg.wasm:0x16aea7
$leptos_reactive::signal::SignalId::update::h905d1da9a60ab89e @ index-f175fbf7a46f3159_bg.wasm:0x3c64f
$leptos_reactive::signal::WriteSignal<T>::update::he23bec14327b0e11 @ index-f175fbf7a46f3159_bg.wasm:0x1c6a62
$leptos_reactive::resource::ResourceState<S,T>::load::{{closure}}::h66b14fa4e2722120 @ index-f175fbf7a46f3159_bg.wasm:0x91098
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbf9dbaba27c30d34 @ index-f175fbf7a46f3159_bg.wasm:0x19a9ba
$wasm_bindgen_futures::task::singlethread::Task::run::he08b7b9202e4b09c @ index-f175fbf7a46f3159_bg.wasm:0xf874d
$wasm_bindgen_futures::queue::QueueState::run_all::h8a5e69f294181d56 @ index-f175fbf7a46f3159_bg.wasm:0xd79ed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::h91c19111c35462a0 @ index-f175fbf7a46f3159_bg.wasm:0x1f130b
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h06e87029aeab0487 @ index-f175fbf7a46f3159_bg.wasm:0x18c405
__wbg_adapter_32 @ index-f175fbf7a46f3159.js:227
real @ index-f175fbf7a46f3159.js:204
Promise.then (async)
imports.wbg.__wbg_then_11f7a54d67b4bfad @ index-f175fbf7a46f3159.js:799
$js_sys::Promise::then::h774f821a071589d7 @ index-f175fbf7a46f3159_bg.wasm:0x1ebb08
$wasm_bindgen_futures::queue::Queue::schedule_task::hf47cce5ec60a789f @ index-f175fbf7a46f3159_bg.wasm:0x134a56
$wasm_bindgen_futures::queue::Queue::push_task::hadc9225120dea999 @ index-f175fbf7a46f3159_bg.wasm:0x22dbaf
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::h2af869a37607c842 @ index-f175fbf7a46f3159_bg.wasm:0x2194dd
$std::thread::local::LocalKey<T>::try_with::h217ab46400f602d2 @ index-f175fbf7a46f3159_bg.wasm:0x1766d6
$std::thread::local::LocalKey<T>::with::hebb9e83d99de1c10 @ index-f175fbf7a46f3159_bg.wasm:0x1e5acc
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::ha78b1c758ce7cbd8 @ index-f175fbf7a46f3159_bg.wasm:0x1a36d8
$wasm_bindgen_futures::task::singlethread::Task::into_raw_waker::raw_wake::h918103560bb54796 @ index-f175fbf7a46f3159_bg.wasm:0x1eb6a9
$core::task::wake::Waker::wake::hace6757ef0d99424 @ index-f175fbf7a46f3159_bg.wasm:0x206402
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::finish::h3dcd346f10e90cc5 @ index-f175fbf7a46f3159_bg.wasm:0xaf6ac
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::{{closure}}::h39bdee9126a8b15b @ index-f175fbf7a46f3159_bg.wasm:0x1cf5c5
$core::ops::function::FnOnce::call_once::h7a2d7111bdbf8aab @ index-f175fbf7a46f3159_bg.wasm:0x1e8976
$<T as wasm_bindgen::closure::WasmClosureFnOnce<A,R>>::into_fn_mut::{{closure}}::h52c020807caaed9a @ index-f175fbf7a46f3159_bg.wasm:0x1e1af4
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h06e87029aeab0487 @ index-f175fbf7a46f3159_bg.wasm:0x18c405
__wbg_adapter_32 @ index-f175fbf7a46f3159.js:227
real @ index-f175fbf7a46f3159.js:204
Promise.then (async)
imports.wbg.__wbg_then_cedad20fbbd9418a @ index-f175fbf7a46f3159.js:803
$js_sys::Promise::then2::h0c592011de175551 @ index-f175fbf7a46f3159_bg.wasm:0x1cf7b6
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h1b2b8113330ef964 @ index-f175fbf7a46f3159_bg.wasm:0x843e2
$gloo_net::http::Response::json::{{closure}}::h31b5a16db4d8a422 @ index-f175fbf7a46f3159_bg.wasm:0x62634
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h8d417c5c28a1e3b4 @ index-f175fbf7a46f3159_bg.wasm:0xc214a
$hackernews_app::api::fetch_api::{{closure}}::h9a17b7529ded0f41 @ index-f175fbf7a46f3159_bg.wasm:0x66c95
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1437aad59b571fbc @ index-f175fbf7a46f3159_bg.wasm:0x125256
$hackernews_app::stories::stories_data::{{closure}}::h98937b75259974ee @ index-f175fbf7a46f3159_bg.wasm:0x60eb9
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2ef2c05d5955bf86 @ index-f175fbf7a46f3159_bg.wasm:0x1253d7
$<leptos_router::data::loader::Loader as core::convert::From<F>>::from::{{closure}}::{{closure}}::h9ea6b8ed3f66b2ee @ index-f175fbf7a46f3159_bg.wasm:0xcbc11
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he4f9b8571886a4f2 @ index-f175fbf7a46f3159_bg.wasm:0x179258
$<core::pin::Pin<P> as core::future::future::Future>::poll::h26c36fd74a5d275c @ index-f175fbf7a46f3159_bg.wasm:0x190574
$leptos_router::data::loader::use_loader::{{closure}}::{{closure}}::h31266e5168750997 @ index-f175fbf7a46f3159_bg.wasm:0x72d63
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h753270ed11f3693b @ index-f175fbf7a46f3159_bg.wasm:0x125558
$<core::pin::Pin<P> as core::future::future::Future>::poll::h60582845f765fe28 @ index-f175fbf7a46f3159_bg.wasm:0x1b8671
$leptos_reactive::resource::ResourceState<S,T>::load::{{closure}}::h66b14fa4e2722120 @ index-f175fbf7a46f3159_bg.wasm:0x90ed9
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbf9dbaba27c30d34 @ index-f175fbf7a46f3159_bg.wasm:0x19a9ba
$wasm_bindgen_futures::task::singlethread::Task::run::he08b7b9202e4b09c @ index-f175fbf7a46f3159_bg.wasm:0xf874d
$wasm_bindgen_futures::queue::QueueState::run_all::h8a5e69f294181d56 @ index-f175fbf7a46f3159_bg.wasm:0xd79ed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::h91c19111c35462a0 @ index-f175fbf7a46f3159_bg.wasm:0x1f130b
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h06e87029aeab0487 @ index-f175fbf7a46f3159_bg.wasm:0x18c405
__wbg_adapter_32 @ index-f175fbf7a46f3159.js:227
real @ index-f175fbf7a46f3159.js:204
Promise.then (async)
imports.wbg.__wbg_then_11f7a54d67b4bfad @ index-f175fbf7a46f3159.js:799
$js_sys::Promise::then::h774f821a071589d7 @ index-f175fbf7a46f3159_bg.wasm:0x1ebb08
$wasm_bindgen_futures::queue::Queue::schedule_task::hf47cce5ec60a789f @ index-f175fbf7a46f3159_bg.wasm:0x134a56
$wasm_bindgen_futures::queue::Queue::push_task::hadc9225120dea999 @ index-f175fbf7a46f3159_bg.wasm:0x22dbaf
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::h2af869a37607c842 @ index-f175fbf7a46f3159_bg.wasm:0x2194dd
$std::thread::local::LocalKey<T>::try_with::h217ab46400f602d2 @ index-f175fbf7a46f3159_bg.wasm:0x1766d6
$std::thread::local::LocalKey<T>::with::hebb9e83d99de1c10 @ index-f175fbf7a46f3159_bg.wasm:0x1e5acc
$wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::ha78b1c758ce7cbd8 @ index-f175fbf7a46f3159_bg.wasm:0x1a36d8
$wasm_bindgen_futures::task::singlethread::Task::into_raw_waker::raw_wake::h918103560bb54796 @ index-f175fbf7a46f3159_bg.wasm:0x1eb6a9
$core::task::wake::Waker::wake::hace6757ef0d99424 @ index-f175fbf7a46f3159_bg.wasm:0x206402
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::finish::h3dcd346f10e90cc5 @ index-f175fbf7a46f3159_bg.wasm:0xaf6ac
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::{{closure}}::h39bdee9126a8b15b @ index-f175fbf7a46f3159_bg.wasm:0x1cf5c5
$core::ops::function::FnOnce::call_once::h7a2d7111bdbf8aab @ index-f175fbf7a46f3159_bg.wasm:0x1e8976
$<T as wasm_bindgen::closure::WasmClosureFnOnce<A,R>>::into_fn_mut::{{closure}}::h52c020807caaed9a @ index-f175fbf7a46f3159_bg.wasm:0x1e1af4
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h06e87029aeab0487 @ index-f175fbf7a46f3159_bg.wasm:0x18c405
__wbg_adapter_32 @ index-f175fbf7a46f3159.js:227
real @ index-f175fbf7a46f3159.js:204
Promise.then (async)
imports.wbg.__wbg_then_cedad20fbbd9418a @ index-f175fbf7a46f3159.js:803
$js_sys::Promise::then2::h0c592011de175551 @ index-f175fbf7a46f3159_bg.wasm:0x1cf7b6
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h1b2b8113330ef964 @ index-f175fbf7a46f3159_bg.wasm:0x843e2
$gloo_net::http::Request::send::{{closure}}::hc154bdd1189128ea @ index-f175fbf7a46f3159_bg.wasm:0x2e53a
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc90c93403dd9fe74 @ index-f175fbf7a46f3159_bg.wasm:0xc2450
$hackernews_app::api::fetch_api::{{closure}}::h9a17b7529ded0f41 @ index-f175fbf7a46f3159_bg.wasm:0x668c7
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1437aad59b571fbc @ index-f175fbf7a46f3159_bg.wasm:0x125256
$hackernews_app::stories::stories_data::{{closure}}::h98937b75259974ee @ index-f175fbf7a46f3159_bg.wasm:0x60eb9
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2ef2c05d5955bf86 @ index-f175fbf7a46f3159_bg.wasm:0x1253d7
$<leptos_router::data::loader::Loader as core::convert::From<F>>::from::{{closure}}::{{closure}}::h9ea6b8ed3f66b2ee @ index-f175fbf7a46f3159_bg.wasm:0xcbc11
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he4f9b8571886a4f2 @ index-f175fbf7a46f3159_bg.wasm:0x179258
$<core::pin::Pin<P> as core::future::future::Future>::poll::h26c36fd74a5d275c @ index-f175fbf7a46f3159_bg.wasm:0x190574
$leptos_router::data::loader::use_loader::{{closure}}::{{closure}}::h31266e5168750997 @ index-f175fbf7a46f3159_bg.wasm:0x72d63
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h753270ed11f3693b @ index-f175fbf7a46f3159_bg.wasm:0x125558
$<core::pin::Pin<P> as core::future::future::Future>::poll::h60582845f765fe28 @ index-f175fbf7a46f3159_bg.wasm:0x1b8671
$leptos_reactive::resource::ResourceState<S,T>::load::{{closure}}::h66b14fa4e2722120 @ index-f175fbf7a46f3159_bg.wasm:0x90ed9
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbf9dbaba27c30d34 @ index-f175fbf7a46f3159_bg.wasm:0x19a9ba
$wasm_bindgen_futures::task::singlethread::Task::run::he08b7b9202e4b09c @ index-f175fbf7a46f3159_bg.wasm:0xf874d
$wasm_bindgen_futures::queue::QueueState::run_all::h8a5e69f294181d56 @ index-f175fbf7a46f3159_bg.wasm:0xd79ed
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::h91c19111c35462a0 @ index-f175fbf7a46f3159_bg.wasm:0x1f130b
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h06e87029aeab0487 @ index-f175fbf7a46f3159_bg.wasm:0x18c405
__wbg_adapter_32 @ index-f175fbf7a46f3159.js:227
real @ index-f175fbf7a46f3159.js:204
Promise.then (async)
imports.wbg.__wbg_then_11f7a54d67b4bfad @ index-f175fbf7a46f3159.js:799
$js_sys::Promise::then::h774f821a071589d7 @ index-f175fbf7a46f3159_bg.wasm:0x1ebb08
$wasm_bindgen_futures::queue::Queue::schedule_task::hf47cce5ec60a789f @ index-f175fbf7a46f3159_bg.wasm:0x134a56
$wasm_bindgen_futures::task::singlethread::Task::spawn::{{closure}}::headbea14ed38df1c @ index-f175fbf7a46f3159_bg.wasm:0x22db72
$std::thread::local::LocalKey<T>::try_with::h207509a41dc2ac8a @ index-f175fbf7a46f3159_bg.wasm:0x15f616
$std::thread::local::LocalKey<T>::with::hc4c2d52374b9879a @ index-f175fbf7a46f3159_bg.wasm:0x1e5a5c
$wasm_bindgen_futures::task::singlethread::Task::spawn::h4874480cc2adb121 @ index-f175fbf7a46f3159_bg.wasm:0xc4584
$wasm_bindgen_futures::spawn_local::h5477a902d1ebd9b0 @ index-f175fbf7a46f3159_bg.wasm:0xf7f91
$leptos_reactive::spawn::spawn_local::h9f70cdcb13714730 @ index-f175fbf7a46f3159_bg.wasm:0x14e738
$leptos_reactive::resource::ResourceState<S,T>::load::h5b40469f19c182cf @ index-f175fbf7a46f3159_bg.wasm:0x6dc23
$leptos_reactive::resource::load_resource::habed565f3313d1b5 @ index-f175fbf7a46f3159_bg.wasm:0x1958b9
$leptos_reactive::resource::create_resource_with_initial_value::{{closure}}::h66328f5ea100d9cd @ index-f175fbf7a46f3159_bg.wasm:0x19a720
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::h1628dabcc5099640 @ index-f175fbf7a46f3159_bg.wasm:0x138967
$leptos_reactive::signal::SignalId::update::hcb5757f313a7bdf3 @ index-f175fbf7a46f3159_bg.wasm:0x4c968
$leptos_reactive::signal::WriteSignal<T>::update::h63f537f2e7cafa10 @ index-f175fbf7a46f3159_bg.wasm:0x20b0da
$leptos_reactive::runtime::Runtime::create_memo::{{closure}}::hddfbe8a23b9d5d21 @ index-f175fbf7a46f3159_bg.wasm:0x10a9a9
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::hf7e9f4c04e80ac9f @ index-f175fbf7a46f3159_bg.wasm:0x71cb0
$leptos_reactive::signal::SignalId::update::h99ca6d8d24375abd @ index-f175fbf7a46f3159_bg.wasm:0x54b21
$leptos_reactive::signal::WriteSignal<T>::update::h3b1f3aae1c3d91fa @ index-f175fbf7a46f3159_bg.wasm:0x20ba22
$leptos_reactive::runtime::Runtime::create_memo::{{closure}}::h5b837b9f80e4a197 @ index-f175fbf7a46f3159_bg.wasm:0x15e023
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::h8be9eefc8b288119 @ index-f175fbf7a46f3159_bg.wasm:0xd5d80
$leptos_reactive::signal::SignalId::update::ha29641ec986f0b94 @ index-f175fbf7a46f3159_bg.wasm:0x591e3
$leptos_reactive::signal::WriteSignal<T>::update::hf96bc7c928a733cd @ index-f175fbf7a46f3159_bg.wasm:0x20bc08
$leptos_reactive::runtime::Runtime::create_memo::{{closure}}::h81565f4c3700aad6 @ index-f175fbf7a46f3159_bg.wasm:0x15e12d
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::h056039cb9134d989 @ index-f175fbf7a46f3159_bg.wasm:0xd4cca
$leptos_reactive::signal::SignalId::update::hc3ec14ebcdd34e2e @ index-f175fbf7a46f3159_bg.wasm:0x562b7
$leptos_reactive::signal::WriteSignal<T>::update::h799789e065622a79 @ index-f175fbf7a46f3159_bg.wasm:0x20bac4
$leptos_reactive::runtime::Runtime::create_memo::{{closure}}::hfc16718136b6d052 @ index-f175fbf7a46f3159_bg.wasm:0x15e44b
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::h373b645e4433a655 @ index-f175fbf7a46f3159_bg.wasm:0xd525c
$leptos_reactive::signal::SignalId::update::hafe0c7eaf3deb2cf @ index-f175fbf7a46f3159_bg.wasm:0x53f56
$leptos_reactive::signal::WriteSignal<T>::update::h242c50f2af315dfe @ index-f175fbf7a46f3159_bg.wasm:0x20b9d1
$leptos_reactive::runtime::Runtime::create_memo::{{closure}}::h353c7bcf1f9b0ac6 @ index-f175fbf7a46f3159_bg.wasm:0x11ecce
$<leptos_reactive::effect::Effect<T,F> as leptos_reactive::effect::AnyEffect>::run::hd0b785c29ed3949d @ index-f175fbf7a46f3159_bg.wasm:0x816c2
$leptos_reactive::signal::SignalId::update::h9d85ae35f86f6d14 @ index-f175fbf7a46f3159_bg.wasm:0x3e820
$leptos_reactive::signal::WriteSignal<T>::update::hcb6ade1b3c7f1663 @ index-f175fbf7a46f3159_bg.wasm:0x1c7107
$leptos_router::components::router::RouterContextInner::navigate_from_route::{{closure}}::h964b391652421402 @ index-f175fbf7a46f3159_bg.wasm:0x2f8c2
$leptos_reactive::scope::Scope::untrack::h04c1de719b058b7b @ index-f175fbf7a46f3159_bg.wasm:0x162ed5
$leptos_router::components::router::RouterContextInner::navigate_from_route::h92ed3f2ad0d840ea @ index-f175fbf7a46f3159_bg.wasm:0x1372b7
$leptos_router::components::router::RouterContextInner::handle_anchor_click::ha49d4d61d0b59043 @ index-f175fbf7a46f3159_bg.wasm:0x1a837
$leptos_router::components::router::RouterContext::new::{{closure}}::hbca5c3cf5c5ac83b @ index-f175fbf7a46f3159_bg.wasm:0x2233e9
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h427cb23d0db8c901 @ index-f175fbf7a46f3159_bg.wasm:0x18c09c
__wbg_adapter_26 @ index-f175fbf7a46f3159.js:219
real @ index-f175fbf7a46f3159.js:204
2index-f175fbf7a46f3159_bg.wasm:0x18fd9c Uncaught (in promise) RuntimeError: unreachable
at std::panicking::rust_panic_with_hook::h96ef8fe2b738eb24 (index-f175fbf7a46f3159_bg.wasm:0x18fd9c)
at std::panicking::begin_panic_handler::{{closure}}::h2012903a365387ff (index-f175fbf7a46f3159_bg.wasm:0x1c03a0)
at std::sys_common::backtrace::__rust_end_short_backtrace::h11a0ade8a412986e (index-f175fbf7a46f3159_bg.wasm:0x24d13c)
at rust_begin_unwind (index-f175fbf7a46f3159_bg.wasm:0x236ae1)
at core::panicking::panic_fmt::h22093794cf4e06c4 (index-f175fbf7a46f3159_bg.wasm:0x2396e1)
at core::result::unwrap_failed::hfbb5af35e2a02401 (index-f175fbf7a46f3159_bg.wasm:0x1d17bd)
at core::result::Result<T,E>::expect::h1e6f95de3500498e (index-f175fbf7a46f3159_bg.wasm:0x1a9058)
at core::cell::RefCell<T>::borrow_mut::hd36c7b39c975b2b6 (index-f175fbf7a46f3159_bg.wasm:0x1bf5cb)
at leptos_reactive::runtime::Runtime::create_signal::h48784ed57dfb1f3f (index-f175fbf7a46f3159_bg.wasm:0xfd64c)
at leptos_reactive::runtime::Runtime::create_memo::he9723da9316a7b85 (index-f175fbf7a46f3159_bg.wasm:0xead4a)
from leptos.
Yeah debugging is made worse for me by the fact that all panics seem to give me a "RuntimeError: unreachable" instead of the actual panic message.
The problem itself seems to come from SignalId::update
at leptos_reactive\src\signal.rs:591
at the borrow:
let value = {
let signals = runtime.signals.borrow();
signals.get(*self).cloned().unwrap_or_else(|| {
panic!("tried to access a signal that has been disposed: {self:?}")
})
};
Is it possible that you would have nested update calls here? It seems odd otherwise that it would be borrowed many times, but I don't have full context on how the framework is structured at this point so it's hard to tell.
Oddly enough, changing this to runtime.signals.try_borrow().expect("")
seems to give me a slightly different result where it crashes less often and when it does it doesn't break the app and only outputs to the console, but I don't know if this is simply a side-effect from something else.
from leptos.
Oh thanks this is really helpful. There are only two places where runtime.signals
is mutably borrowed
When disposing of a scope
https://github.com/gbj/leptos/blob/4ee64816c7f1f55e10da660e0e801e1712388ae5/leptos_reactive/src/scope.rs#L116
When creating a signal
https://github.com/gbj/leptos/blob/98ad27fda57f571856f9ca2d334fce59bd0aca20/leptos_reactive/src/runtime.rs#L81
I think it must be the first one. The page navigation of the router is trying to clean up the scope when you leave the page and it's overlapping with a signal update somewhere. I'm assuming this is a logic issue in the router code somewhere; I don't think it can be fixed at the reactive library level at the moment.
from leptos.
Okay I'm going to leave this for a little bit — I am working on an alternate API for route data loaders anyway here so I will wrap that up and see if it resolves the bug.
from leptos.
This has been fixed by e903e84.
It turns out everything I thought about this was basically wrong, but it led me to fixing at least one bug in the router and significantly increasing the robustness of the reactive system when things go wrong in a way that doesn't really mean we need to panic.
Basically, the issue was that certain async
requests were trying to resolve after their route had already been navigated away from, and therefore the Scope
that the Resource
was tied to had already been disposed. This does not need to panic — it can simply try to update the resource signal and, if it doesn't exist, do nothing. This wasn't currently possible or happening, so you'd get ephemeral/unpredictable crashes, particularly if navigating away from a route in a way that caused it to be removed from the route tree (e.g., going back from comments to the stories list) before the request for the data had actually resolved.
from leptos.
That makes sense.
This is similar to react's setting state after component is unmounted and it also does nothing, except that it warns about it since it means you have a kind of "leak" in a component.
Do you think an warning that it happened would be beneficial at all here? Is that even something that you can do anything about? E.g. by cancelling the async request.
from leptos.
Yeah it makes sense to throw in some debug_warn!
warnings on all the "fail silently" cases.
Canceling the in-flight request is an interesting one. The error in this case was from the request resolving; we do have an on_cleanup
that can be used to run code before a scope is disposed, ie when the route is unloaded.
So what's probably best is to have something like Resource::cancel
that you could call from a cleanup function in user land. In the case of a fetch request it would abort the fetch.
from leptos.
Related Issues (20)
- `<img />` has missing attributes HOT 1
- 0.7 todos
- The on_cleanup function has not been triggered correctly
- ArcAsyncDerived::new_with_initial() setting multiple dependencies will *NOT* hold until the latest change is ready HOT 3
- `leptos_axum::redirect` fails if there is a delay issuing it inside a server function HOT 3
- `ActionForm` with complex args does not work with javascript disabled HOT 2
- Inconsistency in `aria-current="page"` behavior in `<A>`components HOT 1
- Rendering a component in a ProtectedRoute causes resources to be loaded twice
- Content inside of declarative shadow dom is not rendered HOT 5
- Bug: Unexpected Server-Side Resource Evaluation in Leptos 0.7-beta HOT 1
- Inconsistency in client-side query fragment handling HOT 3
- use:directive syntax doesn't work with generic params in Leptos 0.7 HOT 3
- leptos 0.6 fails to compile due to time dependency HOT 2
- GTK example doesn't build on latest main HOT 3
- Implement immediate/synchronous effects HOT 3
- Style does not uninstall when switching pages HOT 5
- template projects fail to build in version 0.6.14 HOT 2
- At … you tried to access a reactive value which was defined at …, but it has already been disposed.
- Server function param custom name HOT 1
- Nested routing broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leptos.