dotansimha / dotansimha/graphql-code-generator-community

typescript-react-query getServerSideProps

Open
#133 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

**Describe the bug**

Using getKey function inside getServerSideProps will cause below error. It works as expect if passing null to it.

Error serializing `.dehydratedState.queries[0].queryKey[1]` returned from `getServerSideProps` in "/b".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value.

Is it better to set a default value to getKey function as null? if not, when we use getQueryData after mutation without manually pass null to getKey function, it will not return the data

**To Reproduce**
Steps to reproduce the behavior:

1. My GraphQL schema:

```graphql
# Put your schema here
```

2. My GraphQL operations:

```graphql
# Put your operations here
```

3. My `codegen.yml` config file:

```yml
# Put your YML here
```

**Expected behavior**

**Environment:**

- OS: Mac
- `@graphql-codegen/...`: 1.21.5
- NodeJS: 14.16.1

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.