apollographql / apollographql/fullstack-tutorial

Using fragment in `launches.js` stops data from being loaded.

Aperta
#41 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
1.2k
Fork
808
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Are you sure that presented fragment is correct? I mean it looks right but when changing from
```
const GET_LAUNCHES = gql`
query launchList($after: String) {
launches(after: $after) {
cursor
hasMore
launches {
id
isBooked
rocket {
id
name
}
mission {
name
missionPatch
}
}
}
}
`;
```
to solution with fragments:

```
export const LAUNCH_TILE_DATA = gql`
fragment LaunchTile on Launch {
__typename
id
isBooked
rocket {
id
name
}
mission {
name
missionPatch
}
}
`;

const GET_LAUNCHES = gql`
query GetLaunchList($after: String) {
launches(after: $after) {
cursor
hasMore
launches {
...LaunchTile
}
}
}
${LAUNCH_TILE_DATA}
`;
```

Data is never properly loaded into the component:
screenshot 2018-11-20 at 10 16 16

When using the fragments I can't see any `POST` request performed against my graphql server.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia in launches.js confrontando la query inline funzionante con la query GET_LAUNCHES basata sui fragmenti, quindi riproduci la richiesta mancante verso il server GraphQL. Il lavoro è completato quando la query basata sui fragmenti invia una richiesta POST e i dati dei lanci vengono caricati nel componente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
graphql, javascript, react
Ambito
api, frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.