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

Remove component NodeRef #2783

Merged
merged 8 commits into from Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/nested_list/src/list.rs
Expand Up @@ -47,9 +47,9 @@ impl From<ListVariant> for Html {
fn from(variant: ListVariant) -> Html {
match variant.props {
Variants::Header(props) => {
VComp::new::<ListHeader>(props, NodeRef::default(), None).into()
VComp::new::<ListHeader>(props, None).into()
}
Variants::Item(props) => VComp::new::<ListItem>(props, NodeRef::default(), None).into(),
Variants::Item(props) => VComp::new::<ListItem>(props, None).into(),
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/yew-macro/src/html_tree/html_component.rs
Expand Up @@ -106,7 +106,6 @@ impl ToTokens for HtmlComponent {
Some(quote! { ::yew::html::ChildrenRenderer::new(#children) })
};
let build_props = props.build_properties_tokens(&props_ty, children_renderer);
let node_ref = props.special().wrap_node_ref_attr();
let key = props.special().wrap_key_attr();
let use_close_tag = close
.as_ref()
Expand All @@ -122,7 +121,7 @@ impl ToTokens for HtmlComponent {
{
#use_close_tag
let __yew_props = #build_props;
::yew::virtual_dom::VChild::<#ty>::new(__yew_props, #node_ref, #key)
::yew::virtual_dom::VChild::<#ty>::new(__yew_props, #key)
}
});
}
Expand Down
16 changes: 16 additions & 0 deletions packages/yew-macro/tests/html_macro/component-fail.rs
Expand Up @@ -65,6 +65,20 @@ fn compile_fail() {
html! { <Child value=1 ref={()} ..props ref={()} /> };
html! { <Child ref={()} ref={()} value=1 with props /> };
html! { <Child ref={()} ref={()} value=1 ..props /> };
html! { <Child with props r#ref={()} r#ref={()} /> };
html! { <Child ..props r#ref={()} r#ref={()} /> };
html! { <Child with props r#ref={()} r#ref={()} value=1 /> };
html! { <Child ..props r#ref={()} r#ref={()} value=1 /> };
html! { <Child with props r#ref={()} value=1 r#ref={()} /> };
html! { <Child ..props r#ref={()} value=1 r#ref={()} /> };
html! { <Child with props value=1 r#ref={()} r#ref={()} /> };
html! { <Child ..props value=1 r#ref={()} r#ref={()} /> };
html! { <Child value=1 with props r#ref={()} r#ref={()} /> };
html! { <Child value=1 ..props r#ref={()} r#ref={()} /> };
html! { <Child value=1 r#ref={()} with props r#ref={()} /> };
html! { <Child value=1 r#ref={()} ..props r#ref={()} /> };
html! { <Child r#ref={()} r#ref={()} value=1 with props /> };
html! { <Child r#ref={()} r#ref={()} value=1 ..props /> };
html! { <Child ..blah /> };
html! { <Child value=1 ..props /> };
html! { <Child .. props value=1 /> };
Expand All @@ -79,6 +93,8 @@ fn compile_fail() {
html! { <Child int=1 string={3} /> };
html! { <Child int=1 ref={()} /> };
html! { <Child int=1 ref={()} ref={()} /> };
html! { <Child int=1 r#ref={()} /> };
html! { <Child int=1 r#ref={()} r#ref={()} /> };
html! { <Child int=0u32 /> };
html! { <Child string="abc" /> };
html! { </Child> };
Expand Down