ctrlplusb / react-tree-walker

Walk a React (or Preact) element tree, executing a "visitor" function against each element.
MIT License
345 stars 34 forks source link

Support concurrent branch traversal #25

Open ctrlplusb opened 6 years ago

ctrlplusb commented 6 years ago

Likely through an experimental flag for now, but as long as we execute from root towards leaf in a concurrent fashion it should be fine as the parent context would have been configured for children.

CosticaPuntaru commented 6 years ago

i don't know if this is the same as what i am looking for, but i think it will be nice to have a flag to walk siblings in a Promise.all fashion to reduce server side load duration.

updates: its work concurrent in :

render(){
   return ([<FirstComponent key={1}/>, <SecondComponent key={2}/>])
}

but not for:

render(){
   return (<div> <FirstComponent /> <SecondComponent /></div>)
}

in the second case the walk is called in sequence

oyeanuj commented 5 years ago

@CosticaPuntaru That's a good idea. Have you tried it yet?

@ctrlplusb Thoughts?