Skip to content

Cache repeated model loads#914

Open
GX88 wants to merge 1 commit into
tscircuit:mainfrom
GX88:cache-duplicate-model-loads
Open

Cache repeated model loads#914
GX88 wants to merge 1 commit into
tscircuit:mainfrom
GX88:cache-duplicate-model-loads

Conversation

@GX88
Copy link
Copy Markdown

@GX88 GX88 commented May 21, 2026

Fixes #93
/claim #93

This adds a shared model cache keyed by the cleaned model URL. Repeated components now reuse the same in-flight/completed load instead of fetching and parsing the same model again.

Each render still gets its own cloned model, including cloned geometry/materials, so hover and translucency state do not leak between duplicate parts.

Checked:

  • bunx biome format src/utils/cached-model-loader.ts src/hooks/use-global-obj-loader.ts src/utils/load-model.ts tests/cached-model-loader.test.ts
  • bunx tsc --noEmit
  • bun run build

Note: I could not run the Bun test file locally because the repo preload imports looks-same/sharp, and sharp failed to finish installing libvips on this Windows machine.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 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 21, 2026 8:39am

Request Review

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.

Improve 3d model loading to avoid laggy browser

1 participant