Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* fixed shema forward() null error

* Avoid creating a new Observable

* Changelog update
  • Loading branch information
kamerontanseli authored and woahitsraj committed Oct 15, 2019
1 parent 9a29742 commit 9ab3a77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- Integrate OneGraph's GraphiQL Explorer. <br/>
[@sgrove](https://github.com/sgrove) in [#199](https://github.com/apollographql/apollo-client-devtools/pull/199)
- Make sure devtools can be used when the transport layer is websockets
only. <br/>
[@kamerontanseli](https://github.com/kamerontanseli) in [#163](https://github.com/apollographql/apollo-client-devtools/pull/163)

## 2.2.1

Expand Down
18 changes: 11 additions & 7 deletions src/backend/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ import { buildSchemasFromTypeDefs } from "./typeDefs";
const apolloClientSchema = {
directives: "directive @connection(key: String!, filter: [String]) on FIELD",
};

const schemaLink = () =>
new ApolloLink((operation, forward) => {
return forward(operation).map(result => {
let { schemas = [] } = operation.getContext();
result.extensions = Object.assign({}, result.extensions, {
schemas: schemas.concat([apolloClientSchema]),
});
return result;
});
const obs = forward(operation);
return obs.map
? obs.map(result => {
let { schemas = [] } = operation.getContext();
result.extensions = Object.assign({}, result.extensions, {
schemas: schemas.concat([apolloClientSchema]),
});
return result;
})
: obs;
});

// Forward all "errors" to next with a good shape for graphiql
Expand Down

0 comments on commit 9ab3a77

Please sign in to comment.