Fluorite
React package

Hooks

useWorkflow for headless embeds, useWorkflowNode for R3F, and the error codes.

useWorkflow

The headless version of <Workflow> — same options, but you own the DOM:

import { useWorkflow } from "@fluorite/react";

const { state, error, backend, animated, containerRef, canvasRef, refresh } =
  useWorkflow(id);
// attach containerRef to a positioned wrapper and canvasRef to a <canvas>

It accepts the same options as <Workflow> (play, dpr, maxFps, forceWebGL, revalidate, revalidateOnFocus, client, callbacks) and returns:

FieldTypeNotes
stateWorkflowStateSee the state machine below
errorWorkflowError | nullSet when state is "error"
backend"webgpu" | "webgl" | nullThe active render backend
animatedbooleanWhether the graph is time-varying
containerRef(el: HTMLElement | null)Attach to the wrapper element
canvasRef(el: HTMLCanvasElement | null)Attach to a <canvas>
refresh() => voidRevalidate the workflow now

States: idle → fetching → compiling → ready, plus paused (play mode says not now) and error.

useWorkflowNode

R3F interop — see the guide. Fetches and evaluates the workflow, returning the TSL node instead of rendering it:

const { node, state, error, animated } = useWorkflowNode(id, { client });

Error codes

All failures surface as a WorkflowError with a stable code and a retryable flag. Switch on code, never on the message.

CodeMeaning
NOT_FOUNDNo workflow with that id
NETWORKThe fetch failed
INVALID_GRAPHThe graph could not be evaluated
UNSUPPORTED_SCHEMAThe payload's schemaVersion is newer than the client
UNSUPPORTED_DEVICENeither WebGPU nor WebGL2 is available
CONTEXT_LOSTThe GPU context was lost
ASSET_FAILEDA texture asset failed to load
UNKNOWNAnything else

On this page