Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] 1.0 #377

Merged
merged 111 commits into from
Nov 8, 2017
Merged

[WIP] 1.0 #377

merged 111 commits into from
Nov 8, 2017

Conversation

kamilkisiela
Copy link
Owner

@kamilkisiela kamilkisiela commented Oct 18, 2017

Get to know the new API:

Let me know what you think.

It's the right time to make suggestions, share ideas etc.

Latest (31.10.2017):

  • apollo-angular@1.0.0-beta.2
  • apollo-angular-link-http@1.0.0-beta.5

You can play with it (31.10.2017):
https://stackblitz.com/edit/simple-apollo-angular-example


NativeScript app:
https://github.com/kamilkisiela/apollo-angular-nativescript

SSR + Store Rehydration:
https://github.com/kamilkisiela/apollo-angular-ssr

Apollo as State Manager
https://stackblitz.com/edit/apollo-angular-state

@Epenance
Copy link

Epenance commented Oct 31, 2017

Been playing with this the last few days and so far almost no issues, big props for making it work so well with most of the old API!

However, I think I'm doing it correct when i define my variables for my mutations, and from looking at the headers in my browser it would appear as if they are included but they dont seem to get attached to my query, which makes it complain.

You can see my code example here: http://jmp.sh/wu0RocY

And this is what i get back in my console when i try to run the query: GraphQL error: Variable "$email" of required type "String!" was not provided.

Even though it shows quite clearly in the headers :) http://jmp.sh/l8d5vRo

@kamilkisiela
Copy link
Owner Author

kamilkisiela commented Oct 31, 2017

@Epenance Hi there! Thanks and that's great it works in your app.

I tried to reproduce same thing you have, which is a mutation + named client.
Here's the result:
https://stackblitz.com/edit/simple-apollo-angular-example-named

See app/upvoter.component.ts. Seems to work

@Epenance
Copy link

@kamilkisiela Thanks for the quick reply, I'm trying to investigate why it wont work on my end, tried to pretty much 1 to 1 copy your example and I'm still having issues. I'll get back when I know more of have given up on my life.

@kamilkisiela
Copy link
Owner Author

@Epenance try to make the same request but without Apollo. Same payload, same url etc. This way we could now if it's Apollo that causing an issue or the gql endpoint

@Epenance
Copy link

Epenance commented Oct 31, 2017

If i simply do it by putting it directly into the string like this it works: http://jmp.sh/BYE1GUA

Btw, is there a better place i could write you so I dont fill up your PR with my "support" issue?

@kamilkisiela
Copy link
Owner Author

@Epenance maybe the Apollo's Slack? Are you there? Same user handle as here, I have :yoda:

@kamilkisiela
Copy link
Owner Author

f520709 allows to type the operation variables

const addTodo = gql`
  mutation addTodo($text: String!) {
    addTodo(text: $text) {
      id
      text
    }
  }
`;

type Todo = {
  id: number;
  text: string;
};

type Mutation = {
  addTodo: Todo;
};

type Variables = {
  text: string;
};

apollo.mutation<Mutation, Variables>({
  mutation,
  variables: { } // TypeScript will warn you that `text` prop is required
}).subscribe();


apollo.mutation<Mutation, Variables>({
  mutation,
  variables: { text: 'Release Apollo' } // TypeScript gives a green light
}).subscribe();

@jakobwilkenson
Copy link

Hi. I know this is an impossible question but how far from production ready to you think this is? I currently have a meteor/ionic app that I'm trying to port off meteor (the meteor/angular integration is too painful) and Apollo seems like a great alternative, but only if it integrates with Angular. This project seems like the perfect solution.

Thanks

@Epenance
Copy link

Epenance commented Nov 1, 2017

@jakobwilkenson I've been testing it for roughly a week now, and the issue i had above turned out to have nothing to do with this lib, but rather my backend.

I'd say its very mature, I've had very little issues with it, mainly just documentation missing but @kamilkisiela is very good at answering on Slack and has been a tremendous help to me.

@jakobwilkenson
Copy link

@Epenance Thanks. I've started playing around with it and I got the stackblitz example working with no problem but as soon as I add it to an ionic project it stops working. When I call query/watchquery it doesn't even make a server request. I'll try to debug it and ping @kamilkisiela if I get stuck

@kamilkisiela
Copy link
Owner Author

I'm finishing an ApolloCache that is based on @ngrx/store and @ngrx/entity so you can use Apollo with ngrx based apps.

@kamilkisiela
Copy link
Owner Author

@jakobwilkenson I think the only part of the API that could be change in near future is the way we use headers in apollo-angular-link-http. I'm going to talk with few people about it and then after few reviews it could be shipped as a RC.

When? I would say, it would be nice to release it as RC before AngularConnect or right after the event but I can't promise that.

This applies to apollo-angular-link-http and apollo-angular itself. @ngrx/store would have to wait to get into RC, it need more testing because it's such a new thing.

@jakobwilkenson
Copy link

@kamilkisiela Sounds good. I think I'll go forward and start porting my project then. Thanks!

@jzahka
Copy link

jzahka commented Nov 7, 2017

@kamilkisiela what are the benefits of using an ngrx based ApolloCache vs the standard in memory ApolloCache?

@Urigo Urigo merged commit 0c1a68b into master Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants