Ralph Component
The<Ralph> component controls iterative loops in Smithers workflows. Named after Ralph Wiggum’s “I’m in danger” catchphrase, it provides safety rails for loops that could potentially run away.
Basic Usage
Props
Maximum number of loop iterations before stopping.
Called at the start of each iteration.
Called when the loop completes normally (no more pending work).
Called when maxIterations is reached.
How It Works
Ralph tracks iterations and pending tasks:State-Driven Iterations
The power of Ralph comes from combining it with Solid.js signals:Phase Transitions
Use Ralph for multi-phase workflows:Task Registration
For custom async operations, use the Ralph context:Combining with Orchestration
Ralph works inside Orchestration for additional controls:Nested Ralph Components
You can nest Ralph components for sub-loops:Debugging
Track what’s happening in the loop:Best Practices
Always set maxIterations
Always set maxIterations
Prevent infinite loops:
Handle maxIterations callback
Handle maxIterations callback
Know when you’ve hit the limit:
Use signals for loop control
Use signals for loop control
Let reactivity drive the loop:
Design for early exit
Design for early exit
Structure so the loop can end before max iterations: