Lucifier129 / react-lite

An implementation of React v15.x that optimizes for small script size
MIT License
1.73k stars 100 forks source link

hello #97

Closed simonjoom closed 7 years ago

simonjoom commented 7 years ago

First lucifer Thanks for react-lite who allow me to boost my web-site

I found an issue on generated iframe with react-lite , i use Sdk Facebook to integrate Facebook page in my react web app, all work good with normal react , but with react-lite: i constated an issue when i change of page on my menu

the problem was in destroyVelem; node.vchildren is null for an iframe /due maybe security stuff or maybe because iframe is generated dynamically/

So i propose you to add just one test if children exist With this test my website work with Facebook now ;))

function destroyVelem(velem, node) { var props = velem.props; console.log(node);console.log(node.vchildren); //--> null var vchildren = node.vchildren; var childNodes = node.childNodes; if(vchildren){ for (var i = 0, len = vchildren.length; i < len; i++) { destroyVnode(vchildren[i], childNodes[i]); } } detachRef(velem.refs, velem.ref, node); node.eventStore = node.vchildren = null; }

Lucifier129 commented 7 years ago

Every element created by virtual-dom has a custom property named vchildren, defaults to empty array, so it's not necessary to check whether node.vchildren is existed or not.

Maybe the node created by virtual-dom had been removed or replaced manually?

simonjoom commented 7 years ago

the fact is after my patch , all works for loading my Facebook page, without i ve got an error .. for me node.vchildren is null and not empty array.. so i ve got a problem.

simonjoom commented 7 years ago

Ps the issue happened when i changed of page (of component) so i guess after the dom is destroyed I think you should to add this test, some users loading dynamic dom (like Facebook button or Facebook page) will be stuck like me

Lucifier129 commented 7 years ago

It's ok to add the test:)

simonjoom commented 7 years ago

cool 👍