supermedium / aframe-react

:atom: Build virtual reality experiences with A-Frame and React.
https://ngokevin.github.io/aframe-react-boilerplate/
MIT License
1.42k stars 151 forks source link

Incorrect check for non-entity prop names #72

Closed robinnorth closed 7 years ago

robinnorth commented 7 years ago

The check for which entity prop names to skip calling setAttribute on is currently broken in v4.0.2, resulting in entities with children having children="[object Object]" attributes set on them, amongst other things.

The indexOf check in

function doSetAttributes (el, props) {
  // Set attributes.
  const nonEntityPropNames = ['children', 'events', 'primitive'];
  Object.keys(props).filter(
    propName => propName.indexOf(nonEntityPropNames) === -1
  ).forEach(propName => { doSetAttribute(el, props, propName); });
}

needs to be reversed.

I'll submit a pull request to fix this soon.