-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
VComp is not mounted #1946
Comments
I have the same issue, which last version didn't happen. Here is the visual example: The code is possible to find here: https://github.com/dancespiele/yew_styles/blob/466d9e77fd39b050a00b33ed52d8d8fbd438e3de/crate/yew_styles/src/components/navbar/navbar_component.rs#L285 |
I was able to work around in the end. I think this version doesn't allow to instance the children more than one. In my case I put a conditional to avoid this issue. I don't know if it is by purpose but in that case the error should be something like "Not allow instance Children more than one time" |
I don’t sure to understand your comment. I tryed to change my code from: fn view(&self) -> yew::Html {
if self.value.iterator.is_empty() {
return yew::html! {
<super::Empty />
};
}
yew::html! {
<ul>…</ul>
}
} to: fn view(&self) -> yew::Html {
yew::html! {
if self.value.iterator.is_empty() {
yew::html! { <super::Empty /> }
} else {
yew::html! { <ul>…</ul> }
}
}
} But the problem persists. |
I never I used fn view(&self) -> yew::Html {
yew::html! {
if self.value.iterator.is_empty() {
yew::html! {}
} else {
yew::html! { <ul>…</ul> }
}
}
} |
Running into this error as well, however it seems unrelated to any comp list. Large app so hard to pinpoint the source, but it always happens when switching from one specific page to another. If that specific page is completely empty there is no panic. If anything at all is rendered on the page before switching, even as simple as an empty div, it panics. |
@intendednull has funded $100.00 to this issue.
|
A reduced example exhibiting this issue can be found under https://github.com/WorldSEnder/yew-bug-1946 . I worked backwards from yew_styles code, so I think it's save to say that it's at least the same issue as that one, and it might be the same issue as @intendednull is facing. The gist seems to be along the lines of: two nested components receive the same event. A component renders a list of component children multiple times. Didn't get to debugging yet, but it might help somebody else to figure out the patch. |
The bug is introduced in cd2b827 and it’s disapear if I remove this line:
But I don’t understand what I really do 🤷 |
Strange update on this. For context, this determines my view let props = props.clone();
match state.page {
Page::Charges => html! {
<charge::Charges ..props />
},
Page::Customer(page) => customer::view(page, &props),
} The error occurs when switching from the pub fn view(page: CustomerPage, props: &Props) -> Html {
let props = props.clone();
match page {
CustomerPage::List => {
html! {
<div>
<ListCustomers ..props />
</div>
}
}
CustomerPage::Create => {
html! {
<create::Create ..props />
}
}
CustomerPage::Details(_) => {
html! {
<details::Details ..props />
}
}
}
} To my astonishment, if I change html! {
<ListCustomers ..props />
} THE ERROR COMPLETELY DISAPPEARS!!! The cause of this is beyond me. Maybe something to do with having a parent that doesn't exist in the other view? |
This does line up with the stack trace in #2065 where the issue is presenting in the |
@mc1098 much appreciated! I'll be trying too whenever I find time. A repro may need to use Yewdux, to trigger the early scheduler call (mentioned in #2065). For more context, my navbar is simply buttons with: let onclick = props.dispatch.reduce_callback(move |s| s.page = *page); And app root looks like this: html! {
<div class="container mx-auto">
<Nav ..props />
{ view }
</div>
} |
@intendednull I wonder whether you would mind trying out a change on this branch of my fork of yew. I'm still trying to repo the issue in an app so I'm not saying it will work but would be interested to see if it fixes the issue or maybe moves the panic point :) |
@mc1098 that fixed it! |
Problem
Since the last update, I have this error:
Steps To Reproduce
I am working on a big application, it’s difficult to extract a minimal example who reproduces the problem.
The error occurs when this component switches between render the empty and list component¹ : list.rs#L37.
¹
empty -> list -> empty
orlist -> empty -> list
, it works when I switch to a page who display the same component (empty or list).Expected behavior
No error.
Environment:
wasm32-unknown-unknown
wasm-pack
Questionnaire
IssueHunt Summary
Backers (Total: $100.00)
Become a backer now!
Or submit a pull request to get the deposits!
Tips
The text was updated successfully, but these errors were encountered: