threlte logo


onSuspend invokes a callback when the component becomes suspended within the boundaries of a <Suspense> component. If there is no <Suspense> component, the callback will never be executed, as the component will never suspend.


The following component loads a model with the hook useGltf and is potentially wrapped in a <Suspense> boundary.

  import { T } from '@threlte/core'
  import { onSuspend, useGltf } from '@threlte/extras'

  const gltf = useGltf('model.gltf')

  onSuspend(() => {
    console.log('The component has been suspended')

{#await gltf then { scene }}
  <T is={scene}>

onSuspend can be used to execute additional logic when a component becomes suspended within a <Suspense> boundary.