Skip to content

Reset model fallback boundary when model URLs change#929

Open
Zhenvip wants to merge 1 commit into
tscircuit:mainfrom
Zhenvip:codex/93-reset-model-fallback-boundary
Open

Reset model fallback boundary when model URLs change#929
Zhenvip wants to merge 1 commit into
tscircuit:mainfrom
Zhenvip:codex/93-reset-model-fallback-boundary

Conversation

@Zhenvip
Copy link
Copy Markdown

@Zhenvip Zhenvip commented May 25, 2026

Summary

  • Add a resetKey to ThreeErrorBoundary so captured loader errors can be cleared when the active model fallback source changes.
  • Key the CAD model fallback error boundary by component id, fallback index, and the current GLTF/mesh/STEP URLs.
  • Add focused regression coverage for reset behavior and URL-sensitive fallback keys.

Why

On current main, the fallback ThreeErrorBoundary is keyed only by component id and fallback index. If a model URL fails once and then changes to a valid replacement URL, the existing boundary can stay in its old error state and immediately skip/advance the new candidate instead of retrying that replacement model. That creates unnecessary fallback churn and can prevent recovered model loads from displaying.

/claim #93

Verification

  • bun test tests/model-fallback-boundary.test.ts -> 3 pass
  • npx biome check src/AnyCadComponent.tsx src/three-components/ThreeErrorBoundary.tsx tests/model-fallback-boundary.test.ts -> no fixes/errors
  • npx tsc --noEmit --pretty false -> exit 0
  • npm run build -> exit 0
  • npm run test:node-bundle -> exit 0
  • git diff --check -> exit 0

Full bun test currently reports 27 passing tests and 3 unrelated existing failures on this checkout:

  • tests/preprocess-circuit-json.test.ts: faux-board z expectations are 0.1 higher than current output.
  • tests/outline-bounds.test.ts: expected older soldermask color string does not match the current rendered SVG color.

AI-assisted with Codex; I reviewed the diff and local verification before submitting.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 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 25, 2026 9:29pm

Request Review

@CharlieLZ
Copy link
Copy Markdown

Additional review notes for the /claim #93 bounty:

  • Vercel preview is available from the bot comment: https://3d-viewer-git-fork-zhenvip-codex-93-reset-mode-4c7e9c-tscircuit.vercel.app
  • This is a narrow fallback lifecycle fix: the error boundary now resets only when the active model source changes, so a previously failed GLTF/OBJ/STEP fallback can retry a replacement URL instead of staying stuck in the old error state.
  • Focused coverage is in tests/model-fallback-boundary.test.ts; local validation commands are listed in the PR body.

This should be non-overlapping with the earlier loader/cache fixes on #93 because it only targets boundary reset behavior after model URL changes.

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