Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
1.91k stars 85 forks source link

fix: Implement `createComment` and `nextSibling` nodeOps #717

Closed garrlker closed 4 weeks ago

garrlker commented 4 weeks ago

Fixes #706

When a component is set to not render with v-if, Vue will

  1. Remove that component from the dom/scene
  2. Call createComment("v-if")
  3. Place that comment at the same spot as the previous component as a placeholder

Then when that component's v-if is set to true again, Vue

  1. Removes that comment
  2. Runs createElement to re-create that component
  3. Places it back into it's original spot in the dom/scene

We were not implementing v-if so Vue did not have a placeholder comment to keep track of v-if'd objects positions. When it called createElement since there was no parent, we were placing it at the scene root

I'm wonder if this has not been working the entire time and none of us noticed?

netlify[bot] commented 4 weeks ago

Deploy Preview for tresjs-docs ready!

Name Link
Latest commit c91c2370fbc1a01585f25f5206f3cca1cad62389
Latest deploy log https://app.netlify.com/sites/tresjs-docs/deploys/665f4098adfc8d0008ef9a73
Deploy Preview https://deploy-preview-717--tresjs-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.