Feature: Standardize the type of fetch policy
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
ReactRelayQueryRenderer uses this as a type of fetchPolicy:
```
const NETWORK_ONLY = 'NETWORK_ONLY';
const STORE_THEN_NETWORK = 'STORE_THEN_NETWORK';
const DataFromEnum = {
NETWORK_ONLY,
STORE_THEN_NETWORK,
};
type DataFrom = $Keys;
```
while
ReactRelayRefetchContainer uses this as a type of fetchPolicy (in ReactRelayTypes.js):
```
export type RefetchOptions = {|
+force?: boolean,
+fetchPolicy?: 'store-or-network' | 'network-only',
|};
```
It would be more convenient to also have DataFrom in ReactRelayTypes and change RefetchOptions like this:
```
export type RefetchOptions = {|
+force?: boolean,
+fetchPolicy?: DataFrom,
|};
```
Contributor guide
Research direction
Start by comparing the fetchPolicy definitions in ReactRelayQueryRenderer and ReactRelayTypes.js, especially RefetchOptions and the existing DataFrom values. Trace their usages to confirm the accepted policy names, then standardize the shared type in ReactRelayTypes.js and verify that both consumers remain type-correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100