dotansimha / dotansimha/graphql-code-generator-community

typescript-msw does not respect `dedupeOperationSuffix` setting

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

Description

### Describe the bug

The `@graphql-codegen/typescript-msw` plugin does not respect the `dedupeOperationSuffix` setting, so it ends up providing duplicated operation names in its handlers.

Example:
```gql
query DogsQuery {
dogs {
name
breed
}
}
```

Ends up with a handler with duplicated operation name:
```tsx
mockDogsQueryQuery(...)
```

### Your Example Website or App

https://codesandbox.io/s/laughing-poitras-f5quix?file=/types.ts

### Steps to Reproduce the Bug or Issue

1. Load the sandbox
2. See duplicated names in MSW handlers, with `dedupeOperationSuffix` set to `true`

### Expected behavior

As I user, I expect `typescript-msw` plugin to respect the `dedupeOperationSuffix` option

### Screenshots or Videos

_No response_

### Platform

- OS: any
- NodeJS: 16
- `graphql` version: 16.6.0
- `@graphql-codegen/*` version: 2.13.1

### Codegen Config File
```yml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
- typescript-operations
- typescript-msw
config:
dedupeOperationSuffix: true
```

### Additional context

_No response_

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.