next.js
c560379f - Add retry, componentStack, and ownerStack to error.js

Commit
243 days ago
Add retry, componentStack, and ownerStack to error.js 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 error during rendering. The error can be from data fetching, or from a RSC phase etc. So in these cases `reset` alone is not enough. The users would even need to implement a retry logic with `router.refresh()`. Therefore this commit adds a new `retry` prop which calls `router.refresh()` and `reset` inside a `startTransition` to provide a built-in retry logic. This feature is expected to preferred over than the `reset` prop. Only the cases where you'd choose `reset` is when you have a reason to do sync reset without loading any new data. This commit also adds `componentStack` and `ownerStack` (dev-only) to the error components API for better DX and debugging error handling.
Author
Committer
Parents
Loading