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

Return wrapped response for ReasonApollo #70

Open
Gregoirevda opened this issue Jan 26, 2019 · 1 comment
Open

Return wrapped response for ReasonApollo #70

Gregoirevda opened this issue Jan 26, 2019 · 1 comment

Comments

@Gregoirevda
Copy link

Gregoirevda commented Jan 26, 2019

Nice to have:

The ppx could return a wrapped ReasonApollo module, based on bs-config, to make the usage easier from reason-apollo:

module AddUser = [%graphql {| ... |} ];
//This could be avoided if the ppx would do this
module AddUserMutation = ReasonApollo.CreateMutation(AddUser);
...
<AddUserMutation>
...{(mutation) => <button onClick={() => {       
        // This is not obvious, this would also be fixed by providing a tighter coupling
        let addNewUserQuery = AddUser.make(~name="Bob", ());
       //                    ^^^^^^^^ should I use AddUser or AddUserMutation
       mutation(~variables=addNewUserQuery##variables,())
  }}> mutate</button>}
</AddUserMutation>
@baransu
Copy link
Contributor

baransu commented Apr 3, 2019

I think it would make graphql_ppx coupled a lot with reason-apollo.

Another solution would be to provide the type of make function making it possible to alias that function in reason-apollo. That way AddUser would be only used to provide it to CreateMutation/CreateQuery/CreateSubscription and creating variables would be the responsibility of AddUserMutation which would be much cleaner for the users

ylecornec pushed a commit to o1-labs/graphql_ppx that referenced this issue Jun 3, 2022
* chore: update files to new name and organization
* chore: fix npm badge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants