settled() function returns a promise that resolves when all pending effects have finished executing. This is useful when you need to wait for the reactive system to fully settle before proceeding.
Import
Signature
Returns
Promise<void>
A promise that resolves when all pending effects have completed
Usage
Waiting for effects to complete
Testing
Chaining operations
Notes
- Similar to
tick()but waits for all effects, not just DOM updates - Useful in testing scenarios
- Guarantees all reactive computations have completed
- Different from
flushSync()which runs synchronously