Closed andretchen0 closed 3 weeks ago
Name | Link |
---|---|
Latest commit | 7a4a733a5439a74348ca9e530b16557459e7de0e |
Latest deploy log | https://app.netlify.com/sites/tresjs-docs/deploys/6663088c93dcba0008f0c278 |
Deploy Preview | https://deploy-preview-726--tresjs-docs.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Hey @alvarosabu , @garrlker
Thanks for the reviews! I think all the raised issues have been covered with the latest push.
Problem
nodeOps
has a few cases where it does type checking that could be pushed down into the called function, makingnodeOps
simpler and the function more robust.Solution
Push predicate into the function:
Problem
nodeOps
contains quite a bit of optional chaining, making code more difficult to read/write than necessary.Solution
Factor out the need for some optional chaining, e.g., with guards.
Problem
Tres doesn't have a way to test/assert some commonly used types:
TresObject
,Object3D
,Fog
, etc. In some cases, it relies on THREE'sis*
fields, but this leads to more complicated/error-prone code than necessary. For example, this ...... can throw an error if the dev forgets the optional chaining (
?
) andchild
isundefined
.Solution
Add
src/utils/is.ts
and accompanying tests.This does not require optional chaining and will not throw if
child
isundefined
.Problem
nodeOps
currently does not have aScene
orTresContext
by default. It must wait until a passed node arrives, containing those objects.Solution
Pass
TresContext
(which containsScene
) tonodeOps
.