apollographql / apollographql/apollo-client-integrations

Using fragments in combination with `PreloadQuery` leads to `unique-names` warnings

Open
#328 16 comments 21 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
556
Forks
53
PR merge metrics
No merged PRs in 30d

Description

# What's the matter?
When using the [PreloadQuery](https://github.com/apollographql/apollo-client-nextjs#preloading-data-in-rsc-for-usage-in-client-components) component with a query that contains fragments, we get following `unique-names` warning in the console:

```
Warning: fragment with name Compoany already exists.
graphql-tag enforces all fragment names across your application to be unique; read more about
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names
```
# What do we expect?
Using `PreloadQuery` should not lead to `unique-names` warnings.

Also: The links is not very helpful because the page doesn't exist anymore.

# How to reproduce?
Take a look into the console of following example https://stackblitz.com/edit/nextjs-869gd8?file=app%2Fexample-query.ts,app%2Fpage.tsx

Contributor guide

No contributing guide indexed for this repository

Research direction

The reproduction uses app/example-query.ts and app/page.tsx in the linked StackBlitz; start there and inspect the PreloadQuery path for fragment handling. Reproduce the console warning, then verify the example runs without unique-names warnings and that the referenced documentation link is current.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, next.js, typescript
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.