Skip to content

Fix GLTF model lifecycle cleanup - #926

Open
DYSfu wants to merge 1 commit into
tscircuit:mainfrom
DYSfu:dysfu/gltf-lifecycle-cleanup
Open

Fix GLTF model lifecycle cleanup#926
DYSfu wants to merge 1 commit into
tscircuit:mainfrom
DYSfu:dysfu/gltf-lifecycle-cleanup

Conversation

@DYSfu

@DYSfu DYSfu commented May 24, 2026

Copy link
Copy Markdown

/claim #93

Summary

  • Load GLTF/GLB assets only when gltfUrl changes, so translucent-state toggles no longer start another GLTFLoader request.
  • Clear stale GLTF state on URL changes and dispose scenes that finish loading after unmount.
  • Add a small Object3D resource disposer for owned geometries, materials, and material textures, with coverage that shared environment maps are left intact.

Validation

  • bun test tests/dispose-object3d-resources.test.ts
  • bunx biome check src/utils/dispose-object3d-resources.ts src/three-components/GltfModel.tsx tests/dispose-object3d-resources.test.ts
  • bunx tsc --noEmit --pretty false
  • bun run build
  • git diff --check

@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
3d-viewer Ready Ready Preview, Comment May 24, 2026 12:50pm

Request Review

@MikeGarciaAGM MikeGarciaAGM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Cleaning up GLTF lifecycle resources is the right fix here, and the test coverage matches the intended disposal behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants