Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v-if is not working correctly #303

Closed
5 tasks done
Tinoooo opened this issue Jun 16, 2023 · 2 comments · Fixed by #409
Closed
5 tasks done

v-if is not working correctly #303

Tinoooo opened this issue Jun 16, 2023 · 2 comments · Fixed by #409
Assignees
Labels
bug Something isn't working

Comments

@Tinoooo
Copy link
Contributor

Tinoooo commented Jun 16, 2023

Describe the bug

Conditionally rendering does not work with v-if.

Reproduction

https://stackblitz.com/edit/stackblitz-starters-ewzdtl?file=src%2Fcomponents%2FTheExperience.vue

Steps to reproduce

Use v-if on a TresGroupand try to make the it's content become visible.

System Info

No response

Used Package Manager

pnpm

Code of Conduct

@Tinoooo Tinoooo added the bug Something isn't working label Jun 16, 2023
@Tinoooo Tinoooo added this to Tres Jun 16, 2023
@bperel
Copy link
Contributor

bperel commented Jul 6, 2023

I also have the issue. Not sure if it's the same bug or not, but when using a raw mesh instead of a mesh wrapped in a group, the click on "click twice" does toggle the cube off then on... but only once: https://stackblitz.com/edit/stackblitz-starters-bumhz6?file=src%2Fcomponents%2FTheExperience.vue. Same thing if I wrap everything within a <template>

@andretchen0
Copy link
Contributor

andretchen0 commented Aug 28, 2023

Here's another pared down StackBlitz exhibiting the error. This time with 2 mesh setups, perhaps leading in a useful direction.

In the example:

  • If the v-if is on a TresMesh that's a child of Scene, toggling off -> on causes the TresMesh to have a null parent.
  • If the v-if is on a TresMesh that's a child of a Group, toggling off -> on works normally.

Expanding on the bug report from @Tinoooo , the problem appears to be elements – not just TresGroup – that are parented to the Scene and toggled with v-if. Here's the StackBlitz from @Tinoooo , but I've parented the v-if'd TresGroup to another TresGroup. It works as expected.

@Tinoooo Tinoooo changed the title v-if on TresGroup is not working correctly v-if is not working correctly Sep 18, 2023
@Tinoooo Tinoooo self-assigned this Sep 19, 2023
@Tinoooo Tinoooo linked a pull request Sep 29, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this to Done in Tres Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants