Closed ab-honda-ichigo closed 3 weeks ago
Sorry, I'm the poster of this issue. I posted with the wrong user, so I'll add a comment to receive a notification.
The issue has something to do with the fact that the element is removed when the event handler is executed. When the element is removed, the event handler is dropped while it is running! It is indeed the same issue as #443 #433 but I think we can leave this open since it provides a good test case for it.
Edit: referenced wrong issue.
Thank you for your detailed explanation. Sorry for the trivial point, but the related issue is #433, not #443.
I can't seem to reproduce this issue anymore in v0.9.0-beta.3
. Here is the complete code listing that I used:
```rust
use sycamore::prelude::*;
use sycamore_router::{navigate, HistoryIntegration, Route, Router};
#[component]
pub async fn PopoverMenu() -> View {
let items = create_signal(vec!["hoge", "fuga", "piyo"]);
view! {
ul {
Indexed(
list=items,
view=move |_| view! {
li(on:click=move |_| navigate("/")) {
"hoge"
}
}
)
}
}
}
#[derive(Debug, Clone, Copy, Route)]
enum AppRoutes {
#[to("/")]
Index,
#[to("/about")]
About,
#[not_found]
NotFound,
}
#[component]
fn App() -> View {
view! {
Router(
integration=HistoryIntegration::new(),
view=|route: ReadSignal
If this issue is not fixed for you, please feel free to reopen this issue or create a new issue.
Describe the bug When I run
navigate
, I get the error "Uncaught Error: closure invoked recursively or after being dropped" in the console. This is reproduced in components usingIndexed
.Oddly enough, this error always appears three times in the console, regardless of the number of
Indexed
items.This can be avoided by providing an
a
element inside theli
element and giving it thehref
attribute. However, what I actually want to do is to implement an implementation that changes the destination according to the condition when the element is clicked, so I think it is necessary to usenavigate
.To Reproduce Below is the source code that this reproduces.
Screenshots
Environment
Additional context I found #433 as a similar issue.