Skip to content

Cache inline STL data geometry#888

Open
fangzheli wants to merge 1 commit into
tscircuit:mainfrom
fangzheli:cache-inline-stl-data
Open

Cache inline STL data geometry#888
fangzheli wants to merge 1 commit into
tscircuit:mainfrom
fangzheli:cache-inline-stl-data

Conversation

@fangzheli
Copy link
Copy Markdown

@fangzheli fangzheli commented May 14, 2026

/claim #93

Summary

  • Cache parsed inline stlData ArrayBuffer geometry with a WeakMap.
  • Return a cloned BufferGeometry per caller so each mounted STLModel can dispose safely during cleanup.
  • Wire only the inline STLModel stlData path through the cache; the stlUrl loader path is unchanged.

Non-overlap

The active PRs I found cover OBJ cache keys, GLTF/GLB loading, direct STL URL geometry loading, STEP-to-GLB conversion, and generic load3DModel URL detection. This PR only addresses repeated parsing for inline stlData ArrayBuffers.

Verification

  • npx --yes bun test tests/load-cached-stl-data-geometry.test.ts
  • npx --yes bun x biome check src/three-components/STLModel.tsx src/utils/load-cached-stl-data-geometry.ts tests/load-cached-stl-data-geometry.test.ts
  • npx --yes bun x tsc --noEmit
  • npx --yes bun run build
  • git diff --check
  • npx --yes bun run test:node-bundle

Full npx --yes bun test currently reports 25 passing tests and 3 failures in tests/outline-bounds.test.ts and tests/preprocess-circuit-json.test.ts; the new focused STL cache test passes.

AI-assisted with Codex; I reviewed the diff and kept the change scoped.

Demo Video

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

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

Project Deployment Actions Updated (UTC)
3d-viewer Ready Ready Preview, Comment May 14, 2026 8:54am

Request Review

@fangzheli
Copy link
Copy Markdown
Author

Demo video for the UI/3D viewer requirement:

https://github.com/fangzheli/3d-viewer/blob/demo-video-pr-888/pr-888-inline-stl-cache-demo-short.mp4

This recording only captures the Storybook iframe for the 3D viewer and shows the model rendering plus orbit interaction.

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.

1 participant