Skip to content
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

Bug in use_drop with nested target #35

Open
ctron opened this issue Jul 28, 2023 · 0 comments
Open

Bug in use_drop with nested target #35

ctron opened this issue Jul 28, 2023 · 0 comments

Comments

@ctron
Copy link
Contributor

ctron commented Jul 28, 2023

I need to create a reproducer, but I think there is a bug in the use_drop when the ref is placed in a nested context:

#[function_component(Other)]
fn other(props: &ChildrenProps) -> Html {
  html!(<div> { for props.children.iter() } </div>)
}

#[function_component(Example)]
fn example() -> Html {
  let node = use_node_ref();
  let drop = use_drop(node.clone());

  html!(
    <div ref={node}> // works when it's here
      <Other>
        <div ref={node}> // but not when it's here
        </div>
      </Other>
    </div>
  )
}

Through the browser's DOM inspector, I can see the events being attached when putting the ref on the other one, but not when it's in the inner one.

ctron added a commit to patternfly-yew/patternfly-yew-quickstart that referenced this issue Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant