fullstack-tutorial
fullstack-tutorial copied to clipboard
Using fragment in `launches.js` stops data from being loaded.
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:
When using the fragments I can't see any POST
request performed against my graphql server.
Yeah, this seems like some weird bug. I can't find the problem. When I run the final/client with fragments and it works on the same localhost server but from what I've edited in start/client it fails to load the data. It sometimes works if you set fetchPolicy to "no-cache".
The code in section 6 of the tutorial is broken. I'm personally reworking it in the next couple of days to fix it.
Scott