next.js
9d13b676 - Add `unstable_retry()` to error.js (#89685)

Commit
89 days ago
Add `unstable_retry()` to error.js (#89685) Extends the error components API to give better control over recovery. Previously, the `reset()` prop only cleared the error state and re-rendered the children. However, this only handles a temporary rendering error. The error can be due to data fetching or an RSC phase. In these cases, `reset()` alone is not sufficient. Users would even need to implement retry logic using `router.refresh()`. Therefore, this PR adds a new `unstable_retry()` prop that calls `router.refresh()` and `reset()` within a `startTransition()` to provide built-in retry logic. This feature is expected to be preferred over the `reset()` prop. Only the cases where you'd choose `reset()` are when you have a reason to do a sync reset without loading any new data. Closes NAR-767
Author
Parents
Loading