atom / etch

Builds components using a simple and explicit API around virtual-dom
MIT License
555 stars 57 forks source link

Apply context to child nodes #72

Closed twifty closed 6 years ago

twifty commented 6 years ago

A fix for #70

I have modified the virtual node returned by dom() to include an array of ambiguous children (those without a known context). On a call to initialize() and updateSync() those nodes are given the context of the component. The render function can then prefer the context over the options object.

This way, any children passed in to a components constructor or update method should already have the context of the outer component applied.

nathansobo commented 6 years ago

Thanks @twifty for taking the time to raise and address this issue. I think your approach makes sense. I'll release this as a new minor bump since it changes the behavior a bit, but we're at major version 0.

nathansobo commented 6 years ago

Published as 0.13.0. There's also a 0.14.0 that includes another change, but I wanted to publish this fix as an independent version in case we run into issues with 0.14.0.

twifty commented 6 years ago

@nathansobo Welcome. Nice to see the functions refs also made it into a release :+1: