anthonyshort / deku

Render interfaces using pure functions and virtual DOM
https://github.com/anthonyshort/deku/tree/master/docs
3.41k stars 130 forks source link

Can't read property 'childNodes' of undefined #367

Closed rstacruz closed 8 years ago

rstacruz commented 8 years ago

I'm not sure what's causing this exactly:

pasted_image_1_8_16__10_36_pm

anthonyshort commented 8 years ago

Probably going to need a bigger test case :P

anthonyshort commented 8 years ago

Can you try this again with rc11?

rstacruz commented 8 years ago

still getting the same.

rstacruz commented 8 years ago

I'm also getting this:

Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.

            removeChild: function removeChild(index) {
              DOMElement.removeChild(childNodes[index]);
            },

likely because I have nulls in my render():

  return <div class='app'>
    { action ?
      <div class='nav'>
        <NavigationShow action={ route.get('action') } />
      </div> : null }

    { context.get('_loading') ?
      <LoadingIndicator /> : null }

    { context.get('error') ?
      <ErrorsShow error={ context.get('error') } /> : null }
   ...
rstacruz commented 8 years ago

Also this, in a case where many DOM elements are to be removed:

Uncaught TypeError: Cannot read property 'type' of null

var isThunk = exports.isThunk = function isThunk(node) {
  return node.type === '#thunk'; // <===
};

isThunk @ index.js:107 removeThunks @ patch.js:109 removeThunks @ patch.js:122 ... replaceNode @ patch.js:91

I'll try to contribute isolated test cases when I get the time.

anthonyshort commented 8 years ago

I added the ability to render null last night. So hopefully this fixes all of these issues.