Skip to content

Recover from stalled Manifold CDN load and surface failed CAD models - #947

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/manifold-load-timeout
Draft

Recover from stalled Manifold CDN load and surface failed CAD models#947
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/manifold-load-timeout

Conversation

@posthog

@posthog posthog Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

The 3D viewer loads the manifold-3d WASM at runtime via a dynamically injected <script type="module"> that does await import(...) from jsdelivr. If that CDN request or the WASM fetch stalls instead of failing cleanly, the script's finally never runs, the manifoldLoaded event never fires, and script.onerror doesn't catch module-import network stalls — so the UI hangs on "Loading Manifold module..." forever with no recovery path.

  • Add a 30s timeout around the Manifold CDN import so a stalled load flips into the existing manifoldLoadingError state instead of hanging indefinitely.
  • Add a Retry button to that error state so the load can be re-attempted (re-runs the loader effect).
  • Guard the async load callbacks so they don't set state after unmount.
  • In AnyCadComponent, when all CAD model URL fallbacks are exhausted, throw so the failure surfaces via the enclosing ThreeErrorBoundaryError3d instead of silently return null — which made components vanish from the 3D view with no error shown.

Why

Users hit a permanent, unrecoverable "Loading Manifold module..." hang on the editor's primary 3D-viewing flow because the Manifold WASM is loaded from a third-party CDN with no timeout or recovery. A related gap made CAD models with exhausted fallbacks disappear silently rather than showing an error.

Follow-up worth considering (not in this PR): self-hosting/bundling the WASM to drop the hard jsdelivr dependency entirely.


Created with PostHog Code from an inbox report.

The 3D viewer loads the manifold-3d WASM at runtime via a dynamically
injected module import from jsdelivr. If that CDN request or the WASM
fetch stalls instead of failing cleanly, the `finally` block never runs,
the `manifoldLoaded` event never fires, `script.onerror` doesn't catch
module-import network stalls, and the UI is stuck on
"Loading Manifold module..." forever with no recovery path.

Add a 30s timeout around the import so a stalled load flips into the
existing `manifoldLoadingError` state, and add a Retry button so the load
can be re-attempted. Also guard the async callbacks against setting state
after unmount.

Separately, when all CAD model URL fallbacks are exhausted in
AnyCadComponent, throw so the failure surfaces via the enclosing
ThreeErrorBoundary -> Error3d instead of silently returning null (which
made components vanish from the 3D view with no error shown).

Generated-By: PostHog Code
Task-Id: 03e743cb-7961-4a33-83c5-012817b3ee41
@vercel

vercel Bot commented Jul 3, 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 3, 2026 7:37am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants