apollographql / apollographql/fullstack-tutorial

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

未关闭
#41 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
1.2k
派生
808
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 launches.js 开始,将正常工作的内联查询与基于片段的 GET_LAUNCHES 查询进行比较,然后针对 GraphQL 服务器重现缺失的请求。当基于片段的查询发送 POST 请求并将发射数据加载到组件中时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
graphql, javascript, react
领域
api, frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。