Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Replace ObservableQueryFields with ObservableQuery in apollo-client #2092

Closed
2 tasks
skovy opened this issue Jun 11, 2018 · 2 comments
Closed
2 tasks

Replace ObservableQueryFields with ObservableQuery in apollo-client #2092

skovy opened this issue Jun 11, 2018 · 2 comments

Comments

@skovy
Copy link
Contributor

skovy commented Jun 11, 2018

Intended outcome:

Actual outcome:

  • The types are defined twice, in both react-apollo and apollo-client 😱

How to reproduce the issue:

This is a basic example. With the update previousQueryResult should be typed as PersonQueryResult. See this apollo-client issue: apollographql/apollo-client#3391

const GET_PERSON = gql`
  {
    person {
      id
      name
    }
  }
`;

interface PersonQueryResult {
  person: {
    name: string;
  }
}

class PersonQuery extends Query<PersonQueryResult> {};

class MyComponent extends React.Component {
  render() {
    return <PersonQuery query={GET_PERSON}>
      {({ subscribeToMore }) => {
        subscribeToMore({
          document: GET_PERSON,
          updateQuery: (previousQueryResult) => {
            return previousQueryResult;
          }
        });

        return <div />;
      }}
    </PersonQuery>
  }
}

Relevant PRs:

@rosskevin
Copy link
Contributor

PR welcome.

@hwillson
Copy link
Member

This was addressed in #2281. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants