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

primitive tag in "React three fiber" not unmount the 3D model even when destroying the parent component #13

Open
bannarisoftwares opened this issue Apr 3, 2023 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@bannarisoftwares
Copy link

Hello @tommasoturchi , Good day. We have react app, have 2 screens and want to render the multiple 3d models on AR screens. While user tap on AR model, we want to update on Main screen. Here model rendered based on targets are working fine. The problem is , On first time, user able to select the model and able to update the Main screen. But on second time, while i am try to open the AR screen, the first time selected 3d model is always rendering on tapped position. I am able to track the second target and second target 3d model also rendering, But the first 3d model is not going and unmounting. So how to unmount the previously selected 3d model from AR screen on each time open ?.

SandBox Link: https://codesandbox.io/s/ar-3d-model-unmount-issue-uf7t68

Target 1 image url : https://hiukim.github.io/mind-ar-js-doc/assets/images/bear-3c737546fb0bde7a9c45b45ee999d132.png

Target 2 image url : https://hiukim.github.io/mind-ar-js-doc/assets/images/raccoon-2ef571baece2ee4724d0d19edf3de791.png

@tommasoturchi
Copy link
Owner

Hi @bannarisoftwares ,
I'll take a closer look, but it might be due to how react-three-mind/you handle component disposal, but I didn't fully understand the problem, could you clarify it a bit?

@tommasoturchi tommasoturchi self-assigned this Apr 25, 2023
@tommasoturchi tommasoturchi added help wanted Extra attention is needed question Further information is requested and removed help wanted Extra attention is needed labels Apr 25, 2023
@amcc
Copy link

amcc commented Oct 17, 2024

not sure if this is a similar problem to what i'm seeing. I am using Next.js to show multiple pages each with a different AR scene. If I load a page with the AR target, then navigate back to my list of AR pages and load a different AR scene I see that the previous react-three-fiber plane is still visible. When i focus on the new target I see two planes with the target image jumping between the two.

I think the threejs objects are not getting disposed of correctly when the component unmounts.

In my case i'm using a videotexture with drei:
import { useVideoTexture, useTexture } from "@react-three/drei";

It could be a specific problem with this - i found that the video would keep playing despite navigating away from the page - a useEffect return to pause it and set the ref.current of the video to null solved that. I expect something else needs unmounting somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants