Skip to content

Dispose generated model resources on cleanup#907

Open
jeffreybarts-max wants to merge 2 commits into
tscircuit:mainfrom
jeffreybarts-max:codex/3d-viewer-dispose-generated-models
Open

Dispose generated model resources on cleanup#907
jeffreybarts-max wants to merge 2 commits into
tscircuit:mainfrom
jeffreybarts-max:codex/3d-viewer-dispose-generated-models

Conversation

@jeffreybarts-max

Copy link
Copy Markdown

Summary

  • Add a small Three.js cleanup helper that disposes mesh geometries and both single/material-array materials.
  • Dispose generated Footprinter and JSCAD model resources when React removes those generated objects.
  • Add unit coverage for nested mesh cleanup and material-array cleanup.

Testing

  • bunx biome check src/utils/dispose-three-object-resources.ts src/three-components/FootprinterModel.tsx src/three-components/JscadModel.tsx tests/dispose-three-object-resources.test.ts
  • bunx tsc --noEmit
  • bun run build
  • bun run test:node-bundle
  • Targeted Bun test for tests/dispose-three-object-resources.test.ts without the global snapshot preload

Note: the default repo-wide bun test path is blocked in this local Windows checkout by the unrelated sharp native module used by the snapshot preload, so I validated the new test in isolation plus the package build/type/bundle checks above.

/claim #93

@vercel

vercel Bot commented May 20, 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 Jul 15, 2026 7:16pm

Request Review

@jeffreybarts-max
jeffreybarts-max force-pushed the codex/3d-viewer-dispose-generated-models branch from af6c85b to b3719d8 Compare July 15, 2026 19:16

Copy link
Copy Markdown

Rebased this branch onto current origin/main and resolved the generated-model conflicts in FootprinterModel and JscadModel by keeping the upstream shadow configuration while preserving the generated resource disposal cleanup.

Validation:

  • bunx biome check src/three-components/FootprinterModel.tsx src/three-components/JscadModel.tsx src/utils/dispose-three-object-resources.ts tests/dispose-three-object-resources.test.ts
  • focused bun test tests/dispose-three-object-resources.test.ts with an empty temporary Bun config to isolate the helper test from the repo-wide SVG preload
  • bun run build
  • bun run test:node-bundle
  • bunx tsc --noEmit
  • git diff --check

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