Recovery standalone (RetryManager)
Si quieres manejar reintentos fuera del boundary:
TS
1import { RetryManager, createExponentialBackoff } from "react-rescuer/recovery";2
3const mgr = new RetryManager(4 {5 maxRetries: 3,6 retryDelay: (attempt) => Math.min(1000, 200 * 2 ** (attempt - 1)),7 },8 createExponentialBackoff(250, 10_000),9);10
11const { ok, attempt, delayMs } = mgr.next(12 "boundary-id",13 new Error("boom"),14 context,15);COPIAR
Comportamiento
next()incrementa el attempt porboundaryId.- Si supera
maxRetries, llamaonMaxRetriesReachedy retorna{ ok: false }. reset(boundaryId)limpia el contador.
Uso
Esto es util si quieres aplicar politicas de reintento fuera del ErrorBoundary.
