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

Updated to support keyed attributes #1076

Merged
merged 20 commits into from Apr 13, 2020
Merged

Conversation

mrh0057
Copy link
Contributor

@mrh0057 mrh0057 commented Apr 4, 2020

Updated to allow keyed attributes.

src/virtual_dom/vtag.rs Outdated Show resolved Hide resolved
src/virtual_dom/vnode.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
@jstarry
Copy link
Member

jstarry commented Apr 5, 2020

Thanks for picking this up @mrh0057! This feature is going to help a lot with performance!!

src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
@jstarry
Copy link
Member

jstarry commented Apr 5, 2020

Another thing to consider is what happens when the root node rendered by a component has a key. It wouldn't do anything.. probably should have a warning I think

Nodes with keys are in a hashmap and nodes without are in vector.
Added an error if duplicate keys are in the hashmap and outputs the duplicate key.

Issue yewstack#479
@mrh0057
Copy link
Contributor Author

mrh0057 commented Apr 5, 2020

Another thing to consider is what happens when the root node rendered by a component has a key. It wouldn't do anything.. probably should have a warning I think

I think by tracking the nodes without a key in a vector fixes this potential issue.

src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vnode.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
@mrh0057
Copy link
Contributor Author

mrh0057 commented Apr 6, 2020

I think I've made all the changes requested expect for the vlist to have a key attribute.

Copy link
Member

@jstarry jstarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! I added some more comments, but they're mostly small nits. Next step is adding a few macro tests, guide here: https://github.com/yewstack/yew/blob/master/CONTRIBUTING.md#macro-tests

crates/macro/src/html_tree/html_list.rs Outdated Show resolved Hide resolved
crates/macro/src/html_tree/html_list.rs Outdated Show resolved Hide resolved
crates/macro/src/html_tree/html_list.rs Outdated Show resolved Hide resolved
crates/macro/src/html_tree/html_list.rs Outdated Show resolved Hide resolved
crates/macro/src/html_tree/html_list.rs Outdated Show resolved Hide resolved
crates/macro/src/html_tree/html_tag/mod.rs Outdated Show resolved Hide resolved
src/virtual_dom/vlist.rs Show resolved Hide resolved
src/virtual_dom/vlist.rs Outdated Show resolved Hide resolved
src/virtual_dom/vtag.rs Outdated Show resolved Hide resolved
@jstarry
Copy link
Member

jstarry commented Apr 6, 2020

sweet! thanks so much! last thing is making CI happy, could you please run cargo fmt?

@jstarry
Copy link
Member

jstarry commented Apr 6, 2020

Thanks, there are still two comments that are unaddressed:
#1076 (comment)
#1076 (comment)

Removed the key comparision for vtag.
@jstarry
Copy link
Member

jstarry commented Apr 13, 2020

Thanks so much @mrh0057! I just fixed up one last clippy thing and now merging!

@jstarry jstarry merged commit e9de165 into yewstack:master Apr 13, 2020
@Korede-TA
Copy link

is this change going to be in the next release of Yew?

@jstarry
Copy link
Member

jstarry commented Apr 23, 2020

@Korede-TA yes! I should be able to put a release soon :)

@jstarry
Copy link
Member

jstarry commented Apr 25, 2020

@Korede-TA v0.15 has just been released with this feature!

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

Successfully merging this pull request may close these issues.

None yet

4 participants