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

Draft: Design principles #7

Merged
merged 15 commits into from
Mar 22, 2016
Merged

Draft: Design principles #7

merged 15 commits into from
Mar 22, 2016

Conversation

stubailo
Copy link
Contributor

I think we should agree on a set of principles that define why this library exists. They will help frame future decisions about the design, and make it clear how it is different from other GraphQL client libraries.

@stubailo
Copy link
Contributor Author

@jbaxleyiii @helfer if you have time would be good to get your eyes on this!

@jbaxleyiii
Copy link
Contributor

Optimistic UI for mutations

Are you thinking about direct view layer integration, or hooks / callbacks to be applied to the view layer as is spec of the view library?

A potential 8. or 7.a that I would love to see is a spec for requesting the total count of a data source with or without arguments applied. This is less of a client feature though 👍

Otherwise, I think this looks great. I'm not sure if I'm more excited about the library, or writing analytics and reporting middleware for it haha.

@stubailo
Copy link
Contributor Author

By optimistic ui I mean being able to modify the cache temporarily and see that reflected in the UI, then roll back that change later when you get the real response from the server.

@stubailo
Copy link
Contributor Author

As for tools, the things I'd most love to see are debugging and logging - so that you can easily track what queries are represented in your UI, and how they translate to server requests!

4. The ability to preload data you might need later
5. Minimal server roundtrips to render the initial UI
6. Query aggregation from your UI tree
7. Basic handling of pagination, most critically being able to fetch a new page of items when you already have some
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and pre-fetching?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tied to UI, so you decide when to request the next page of data. So you can trigger it early, before the UI needs it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I wasn’t speaking about point 7. specifically but just wanted to add “pre-fetching” as a necessary feature. Turns out that this was already listed (as 4.) and I missed it, oops.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's exactly (4)!

@martijnwalraven
Copy link
Contributor

I really like these design principles, so my questions are primarily about better understanding what we are and are not building.

  • Is the main reason we're not building on Relay the fact that its codebase is too complex and would contradict the principles of transparency and modularity? What are we missing out on because we're not using Relay?
  • Are we building on Redux then, or is this a completely new effort? (The README says 'A simple but functional GraphQL client built on Redux for a great development experience.', but the repo tagline says 'An easy to use and understand JavaScript GraphQL client with Relay's most useful features').
  • How does this library relate to the high level design for reactivity? For instance, is dependency tracking a design goal for the client?

@lorensr
Copy link
Contributor

lorensr commented Mar 20, 2016

make it clear how it is different from other GraphQL client libraries.

Further help would be including in docs at launch a list of the other major libs and what the differences are.

How does this library relate to the high level design for reactivity?

It's the entire "Client data" layer, right?

image

For instance, is dependency tracking a design goal for the client?

Falls under "There might be optimizations that rely on specific server-side features", but might be nice addition to implementation section

  1. Minimal server roundtrips to render the initial UI

Any plans for a fast-render equivalent?

@stubailo
Copy link
Contributor Author

@martijnwalraven:

Is the main reason we're not building on Relay the fact that its codebase is too complex and would contradict the principles of transparency and modularity?

It doesn't seem to me that Relay was built from the start with these ideas in mind. There are some efforts to factor out some of the core libraries, and I'm going to be following and hopefully contributing to those with great interest. I think it will be easier to determine the tradeoffs after another week of prototyping.

What are we missing out on because we're not using Relay?

This is the hardest part to truly understand, and will also be helped by a few weeks of prototyping, testing, and hopefully talking to the Relay team in depth. I think there's a world where Relay is the most optimized approach that has all of the bells and whistles, and you use it if your app has very strict performance requirements. Then the most useful features from Relay can be brought into the Apollo client for people who don't need as much of that.

Are we building on Redux then, or is this a completely new effort? (The README says 'A simple but functional GraphQL client built on Redux for a great development experience.', but the repo tagline says 'An easy to use and understand JavaScript GraphQL client with Relay's most useful features').

Good point. I've made the tagline in the README more vague. I'm worried that the word "Redux" might immediately confuse people into thinking they have to buy into the whole Redux philosophy to use this. I suspect Redux will be a useful part of the implementation, but we'll cross that bridge when we get there.

How does this library relate to the high level design for reactivity? For instance, is dependency tracking a design goal for the client?

I think having a client that can support this stuff easily via an extension should be a primary goal. It would be built on feature (3. The ability to manually refetch data when you know it has changed).

To be fair, our understanding of the server-side design has changed quite a bit as well since that initial document, so hopefully we can make that more clear soon (we have a devshop talk and some blog posts coming out about that in the next few weeks).

@lorensr:

Further help would be including in docs at launch a list of the other major libs and what the differences are.

Great idea! As a good side-effect, this will force us to really understand those other libraries.

Any plans for a fast-render equivalent?

I think it should be easy to do the query aggregation on the server, then hydrate the store on the client. This is something we get for free from the design principle of the store being a plain object, so you can serialize it and send it around wherever you want.

@helfer
Copy link
Contributor

helfer commented Mar 22, 2016

I think these principles are exactly right. I just have one nitpick about the feature list: I assume these are not in order of importance/priority, so I would use bullet points instead of numbers. If this is indeed by order of importance, then I think we should have a discussion about that specifically.

@stubailo stubailo force-pushed the design-principles branch from 139052f to 6d604b1 Compare March 22, 2016 00:36
stubailo pushed a commit that referenced this pull request Mar 22, 2016
@stubailo stubailo merged commit 3530ff7 into master Mar 22, 2016
@stubailo
Copy link
Contributor Author

Merged it in! Please submit PRs for further comments and improvements.

@stubailo stubailo deleted the design-principles branch March 22, 2016 06:53
martijnwalraven pushed a commit that referenced this pull request Apr 8, 2016
Small typo in FilmType.planetConnection field
jbaxleyiii pushed a commit that referenced this pull request Oct 18, 2017
Fixes #7 and as a result we can clean up types a fair bit
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants