clicking an entity with texture results in fatal error
Closed this issue · 6 comments
e.match is not a function
to reproduce
- load index html file with mapbox component
index-mapbox-intersection.html
- click on entity for mapbox
- see UI disappear
- see console error:
Uncaught TypeError: e.match is not a function
andThe above error occurred in the <TextureWidget> component
Note, this same error is raised with native a-frame inspector 1.3, however it is not a fatal error and end-user does not notice.
Hi @kfarr
I investigated this issue, looks like error is raising because of this line (150).
https://github.com/3DStreet/3dstreet-editor/blob/master/src/components/widgets/TextureWidget.js#L150
When I commented it, it worked fine, no error.
But I'm not sure that we can remove this line, as it can break something.
Can you please check it? Thanks in advance!
Thanks for pointing to the cause. In some cases in the future it may be helpful to have this function still working when possible.
It seems like the error case is when src
is not the type that parseUrl
expects (a TypeError?), but this case is not handled properly by parseUrl? In other words, the match
function is only found on Strings, so if a string not passed it will have error.
So, maybe this needs to check if value is a string
before calling that function? If not a string then don't call the function?
Yes, it's a very good point and make sense
Thanks for the advice!
So why don't you have a string or HTMLImageElement here in the first place? What do you have instead? You didn't say.
Are you sure it's not the isAssetImg
check that is wrong? Do you have something specific in 3dstreet? Do we need a fix in aframe-inspector for a similiar issue?
FYI I did a fix for video texture here aframevr/aframe-inspector#680
If you reproduce your issue on latest aframe-inspector master, it will be great if you can create an issue there with an example so we can fix it for everyone.