facebook / facebook/relay

Docs for examples about error handling with ErrorBoundary

Open
#3,506 1 comment 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

It is a fix for documentation regarding ErrorBoundary. PR will be provided.

In the example for `ErrorBoundaryWithRetry` if `getDerivedStateFromError` resets the `fetchKey` in each error, then the `fetchKey` will not change every time you retry, and therefore relay is not triggering the fetch else just returning the same `error` probably in cache. While if we just reset the error `return {error};` we can see the fetch working in the network all the time.

Another fix are the TS typings, by default and without any extra anotation we are able to return `Partial` ... that makes more sense for the case mentioned above, but also for the other examples in this file.

```ts
// Type definitions for React 16.9

type GetDerivedStateFromError =. (error: any) => Partial | null;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.