mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
Fix toggle_all panic
This commit is contained in:
parent
e3c1291942
commit
01807ea514
2 changed files with 8 additions and 2 deletions
|
@ -211,7 +211,7 @@ pub fn TodoMVC(cx: Scope) -> Element {
|
|||
>
|
||||
<input id="toggle-all" class="toggle-all" type="checkbox"
|
||||
prop:checked={move || todos.with(|t| t.remaining() > 0)}
|
||||
on:input=move |_| set_todos.update(|t| t.toggle_all())
|
||||
on:input=move |_| todos.with(|t| t.toggle_all())
|
||||
/>
|
||||
<label for="toggle-all">"Mark all as complete"</label>
|
||||
<ul class="todo-list">
|
||||
|
|
|
@ -644,7 +644,13 @@ impl SignalId {
|
|||
}
|
||||
}
|
||||
}?;
|
||||
let value = value.borrow();
|
||||
let value = value.try_borrow().unwrap_or_else(|e| {
|
||||
debug_warn!(
|
||||
"Signal::try_with_no_subscription failed on Signal<{}>. It seems you're trying to read the value of a signal within an effect caused by updating the signal.",
|
||||
std::any::type_name::<T>()
|
||||
);
|
||||
panic!("{e}");
|
||||
});
|
||||
let value = value
|
||||
.downcast_ref::<T>()
|
||||
.ok_or_else(|| SignalError::Type(std::any::type_name::<T>()))?;
|
||||
|
|
Loading…
Reference in a new issue