apollographql / apollographql/apollo-client-integrations

fetchPolicy and nextFetchPolicy have fixed values for PreloadQuery

Open
#429 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
556
Forks
53
PR merge metrics
No merged PRs in 30d

Description

When using the PreloadQuery, you will get a TypeScript error if you're trying to set the value of `fetchPolicy` to something other than `cache-first`.
`nextFetchPolicy` is typed to always be `undefined`.

```typescript
type RestrictedPreloadOptions = {
fetchPolicy?: "cache-first";
returnPartialData?: false;
nextFetchPolicy?: undefined;
pollInterval?: undefined;
};
type PreloadQueryOptions = QueryOptions & RestrictedPreloadOptions;
```

Is this intended?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the RestrictedPreloadOptions and PreloadQueryOptions definitions shown in the issue, then trace how PreloadQuery consumes QueryOptions and its fetch-policy types. Determine which policies are intended to be supported; done means the TypeScript types match that decision and the relevant type checks cover fetchPolicy and nextFetchPolicy.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
api, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.