Skip to content

Errors and loading UI

Model loading

tsx
<ModelLabViewer
  src="/models/product.glb"
  onLoad={(info) => setStatus(`Loaded ${info.stats.vertices} vertices`)}
  onError={(error) => {
    setStatus('The interactive model is unavailable.')
    reportError(error)
  }}
/>

The built-in runtime displays a centered loading or error message inside the canvas. Wrap the viewer to add branded skeletons, retry controls, or static fallbacks.

Texture loading

Replacement textures fail independently from the model:

tsx
onTextureError={(name, error) => {
  telemetry.capture('model_texture_error', { name, message: error.message })
}}

Common causes

  • Wrong public URL
  • CORS blocked on a remote model or texture
  • Missing GLTF .bin or image dependency
  • Incorrect resourcePath
  • Missing Draco decoder files
  • Unsupported GPU or WebGL disabled

Runtime guards

Use parseViewerPreset() and parseSequencePayload() at trust boundaries. Do not pass arbitrary JSON directly into rendering components.

Released under the MIT License.