pmndrs / three-stdlib

📚 Stand-alone library of threejs examples designed to run without transpilation in node & browser
https://npmjs.com/three-stdlib
MIT License
704 stars 117 forks source link

fix(GLTFLoader): harden navigator check #267

Closed bujoralexandru closed 1 year ago

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e770cfc4971ff6fdade7fb0b13c206e61f0a77d5:

Sandbox Source
Vanilla Configuration
CodyJasonBennett commented 1 year ago

react-native doesn't define this key? This will affect texture upload in three.js core as well.

https://github.com/mrdoob/three.js/blob/c6536d83799dbfacd03ab65a30a9790b4af6b2ea/src/renderers/webgl/WebGLTextures.js#L14

FWIW I'm in favor of this change for the sake of correctness, but three.js won't be very forgiving. They're very happy to allow even undefined behavior if they can shift the blame.

bujoralexandru commented 1 year ago

The highlighted line does not "suffer" from the same problem. Apparently, navigator has the following structure in 0.71.8:

{ product: string }

While the typeof navigator === 'undefined' will return false, the regex check will be ok.

LE.: Idk if react-native is doing something fishy with the navigator object, or expo has something to do with it.

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 2.23.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket: