aframevr / aframe-inspector

:mag: Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
https://aframe.io/aframe-inspector/examples/
MIT License
654 stars 201 forks source link

Error "Cannot use 'in' operator to search" throwed after click in some elements #674

Closed niksonleonard closed 1 year ago

niksonleonard commented 1 year ago

When clicking in a camera element many sequential "cannot use 'in' operator to search" error happen:

TypeError: cannot use 'in' operator to search for "acceleration" in "true"

This is happening because in the PropertyRow component in Render method it is trying to iterate a value that not always is a object.

...
const className = classNames({
      propertyRow: true,
      propertyRowDefined: props.isSingle
        ? !!props.entity.getDOMAttribute(props.componentname)
        : props.name in
          (props.entity.getDOMAttribute(props.componentname) || {})
    });
...
vincentfretin commented 1 year ago

I don't reproduce the issue. Do you reproduce it on the example in this repo? acceleration prop is from wasd-controls component apparently. There is a check props.isSingle, it should do the in operator only if isSingle is false.

I added console.log(props.isSingle,props.name,props.entity.getDOMAttribute(props.componentname)) before https://github.com/aframevr/aframe-inspector/blob/75b03420ef944c45e937201648c532d1b6a53bd5/src/components/components/PropertyRow.js#L137

If I add wasd-controls on a camera I get: false 'acceleration' {}

if I edit the accelereration I get: false 'acceleration' {acceleration: 70}

Why do have true instead of an object? Are you using wasd-controls instead of wasd-controls="" in a react context by any chance? That's probably the only explanation here, wasd-controls is equivalent to wasd-controls={true}

dmarcos commented 1 year ago

I think this is no longer an issue. Closing but can reopen if necessary. Thanks

uurcank commented 1 year ago

this is still an issue for me @dmarcos

try <a-box fog="true"></a-box> and this error happens

vincentfretin commented 1 year ago

@uurcank Thank you for the reproducible case! There is indeed an issue here, I created #694 As a workaround for now you can use material="fog:true" that doesn't produce the error.