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

Mutation example needed #262

Open
yakneens opened this issue Oct 24, 2017 · 8 comments
Open

Mutation example needed #262

yakneens opened this issue Oct 24, 2017 · 8 comments

Comments

@yakneens
Copy link

This is a great boilerplate, but it bills itself as not only being for static sites but also for single-page-applications, thus it would be nice to see examples of full object CRUD. I would be very grateful if you could work the Create, Update, and Delete mutations on Story into this current framework.

@DaveyEdwards
Copy link

I know the relay mutations on the frontend side are not in this project yet, but if you are wondering about the backend mutations to go with this you can find them here

https://github.com/kriasoft/nodejs-api-starter/tree/master/src/schema

@yakneens
Copy link
Author

Thanks, I appreciate the link. The back-end honestly is just so much more straightforward and testable. The front-end is, however, pure black magic, to the point where I'm starting to doubt whether Relay is a good framework to move forward with. Support on the FB side seems nonexistent which is a real shame. Thanks again for your help though.

@DaveyEdwards
Copy link

DaveyEdwards commented Nov 12, 2017

Relay mutations on the frontend are actually alot easier then most think once you get one working. After that it is mostly copy paste and change a few fields. Ill post a link to my static-boilerplate here when I finish hooking up my frontend.

If you want to see my old project with relay mutations here was a base project I had working (based on react-starter-kit) https://github.com/DaveyEdwards/myiworlds/tree/master/src/routes/createCircle (I was trying many things in there so the project is quite messy). Is there something in particular that confuses you about relay?

If your building something that you wish to be very performant for global scale Id recommend keeping with it until something blows it out of the water :)

@yakneens
Copy link
Author

yakneens commented Nov 12, 2017

Thanks @DaveyEdwards, I appreciate your offer of help, and the link to your repo. My plight is documented in this issue - facebook/relay#2178, and my actual repo that is based on react-static-boilerplate is here - https://github.com/llevar/react-test2/tree/master/src/Home, it basically has to do with updating the store after the mutation succeeds on the server.

I also am not sure I really understand how one is meant to implement a page that features a list of objects that don't really have a parent in the object model. All of the Relay examples I have seen that feature a list are implementing a one-to-many relationship using a Connection, but my use case has a list that is top-level. I'm still implementing it using a Connection which maybe isn't right, but I'm not sure how one is supposed to do it otherwise. I honestly think this is a basic enough use case that there should be more than one working example out there already - a page with a table, where you can do CRUD on its rows and it dynamically updates. But so far no dice.

I'd be much obliged if you have any ideas...

@DaveyEdwards
Copy link

I tried to look through your problem, but am unable to offer any advice. I havn't touched relay mutations in a little while so its not fresh in my mind. It looks like your doing things right, except I have never done anything with the connection like client:root:allWorkflows{"first":50}".
I would recommend to post your question on stack overflow for best change at getting help, and then just search github for projects using the specific problem your having. example "ConnectionHandler.getConnection" and search by javascript (looking how others have done it and comparing it to my own has been my best resource with relay/graphql)

@Filson14
Copy link

Hi @llevar , have You resolved Your problem with list update after mutation? I deal with similar use case and wonder if You can provide any clue 😉

@rdhanaraj
Copy link

Having the same blocker here in 2019. Will see if I can get something to work.

@koistya
Copy link
Member

koistya commented Sep 11, 2019

You may find some examples here:

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

5 participants