Skip to content

Cache shared 3D model loads#887

Open
starburtMr wants to merge 1 commit into
tscircuit:mainfrom
starburtMr:codex/cache-load-3d-model
Open

Cache shared 3D model loads#887
starburtMr wants to merge 1 commit into
tscircuit:mainfrom
starburtMr:codex/cache-load-3d-model

Conversation

@starburtMr
Copy link
Copy Markdown

Fixes #93
/claim #93

Summary

  • Cache load3DModel template loads by normalized URL so duplicate model URLs share in-flight/completed loader work.
  • Strip only cachebust_origin from cache keys while preserving meaningful query params and hashes.
  • Detect model type from the URL pathname before query/hash fragments, so model.glb?cachebust_origin=... and similar URLs route to the right loader.
  • Return a cloned object per call with cloned materials so per-instance transparency/hover state cannot leak across repeated models.

Validation

  • bun test tests/load-model.test.ts
  • bunx biome check src/utils/load-model.ts tests/load-model.test.ts
  • bunx tsc --noEmit
  • bun run build
  • git diff --check

Notes

  • Full bun test currently has unrelated existing failures in tests/outline-bounds.test.ts and tests/preprocess-circuit-json.test.ts; the new focused loader tests pass.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 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 13, 2026 3:28am

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