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

Ideas for improving the Developer Experience and Feature Discoverability #10

Open
FluorescentHallucinogen opened this issue Mar 14, 2019 · 57 comments

Comments

@FluorescentHallucinogen
Copy link
Contributor

FluorescentHallucinogen commented Mar 14, 2019

This issue acts as the central place for all discussions of ideas around improving the Developer Experience (DX), Feature Discoverability, Usability and UI design.

  1. It would be great to be able to insert all fields of type (check all nested checkboxes at once and then uncheck only unnecessary instead of check them only one by one). This is very useful for types with a large number of fields.

  2. If a field is 1) non-null AND 2) leaf (terminal / uncollapsible / has no child fields), it should be 1) checked AND 2) disabled (so the user could not uncheck it).

I've visualized these two ideas. Here's my vision (a slightly modified version of Explorer tab from Playground v2 concept):

after

Compare it with the original:

before

@FluorescentHallucinogen
Copy link
Contributor Author

@dwwoelfel @sgrove @rofrischmann PTAL. 😉

@FluorescentHallucinogen
Copy link
Contributor Author

I've improved some things:

  • It would be great to visually separate the input fields (arguments) from the output (asked) fields by
  1. placing input fields into brackets
  2. using different colors for input and output fields
  • I've used the same colors for the same things in Explorer and Query editor (green for output fields, orange for input fields, etc.).

  • I've realized that "Insert all fields" feature should check nested checkboxes only for all output fields, not for input fileds.

  • If the input field (argument) is required (non-null), it must be 1) checked by default AND 2) disabled (so the user could not uncheck it) to avoid generating invalid query.

  • If the output field is 1) leaf (terminal / uncollapsible / has no child fields) AND 2) the only field of the (parent) type [see the count in the lastMonth on the attached image], it must be 1) checked by default AND 2) disabled (so the user could not uncheck it) to avoid the Field 'xxx' of type 'YYY' must have a sub selection error.

explorer-improved

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented May 1, 2019

Added one small, but very useful thing — field descriptions on hover:

explorer-final

@FluorescentHallucinogen
Copy link
Contributor Author

Let me explain some important things about checkboxes and rotating triangles that may not be obvious.

  1. Rotating triangles indicate that a field has child fields. Leaf (terminal) fields has no rotating triangles. In the current implementation there is no visual difference between leaf (terminal) fields and not, the user can't predict what will happen when he clicks on the checkbox (will it expand child fields or just check it).

  2. Only clicking on the checkboxes checks all child fields (checkboxes):

1

Clicking on the rotating triangles and field names only expand child fields without checking (inserting) them:

2
3

This is because inserting all child fileds in GraphQL is, generally speaking, bad practice, and can't be the default behavior. The one of the main ideas of GraphQL is to solve the overfetching problem (when API return additional data that's not needed), it gives you the power to ask (show) for what data you need and get exactly that, nothing more and nothing less. Inserting all child fileds may help to overfetching (if the user doesn't care about removing unnecessary fields). But in some cases the inserting all child fileds feature improves the DX (developer experience), e.g. in the case of very complex (auto-generated) API that has large number of types and large number of fields in each type. In this case, it is faster to check all nested checkboxes at once and then uncheck only unnecessary instead of check them only one by one.

That's why inserting all child fileds should be here, but shouldn't be the default behavior.

@FluorescentHallucinogen FluorescentHallucinogen changed the title [UX] Improve autocompletion: insert all fields of type Ideas for improving the Developer Experience and Feature Discoverability May 10, 2019
@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented May 10, 2019

Here's the updated mockup based on the preview of the new Explorer version:

explorer-v2

Please note that I've added a button for adding fragments along with buttons for adding queries, mutations and subscriptions.

@FluorescentHallucinogen
Copy link
Contributor Author

Everything is clear with the addition of new queries/mutations/subscriptions/fragments, but what about the deletion?

I've added icons to clone (with all checked fields) and delete queries:

clone-delete-1

clone-delete-2

These icons are displayed when hovering over the query.

@FluorescentHallucinogen
Copy link
Contributor Author

Have added support for GraphQL aliases:

You can clone any node (with all child field) as GraphQL alias using the "Clone" icon that is displayed when hovering over the node:

aliases-1

You can remove any alias using the "Delete" icon:

aliases-2

You can rename and edit aliases in your own:

aliases-3

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented May 12, 2019

The preview of the new Explorer version has one interesting feature — "Jump to definition" via Alt+Shift-click on the field in code editor. But, IMO, it has low feature discoverability. How users learn about this hotkeys?

What about a "View" icon that is displayed when hovering over the field in code editor to focus on this field in Explorer, and vice versa? 😉

focus-1
focus-2

@FluorescentHallucinogen
Copy link
Contributor Author

@JakeDawkins PTAL. What about something like that for Apollo GraphQL for VS Code extension?

@JakeDawkins
Copy link

@JakeDawkins PTAL. What about something like that for Apollo GraphQL for VS Code extension?

👋 Yeah! This is beautiful! I'd love to see something like this in the future. We have a bit of work to do in VS Code around stability and service federation before this could be prioritized, but I'll keep it in mind :)

@FluorescentHallucinogen
Copy link
Contributor Author

I've added icons to refactor/transform any input fields to variables (see altair-graphql/altair#745 for more info). These icons are displayed when hovering over the input fields:

refactor-input-to-variable-1

refactor-input-to-variable-2

@FluorescentHallucinogen
Copy link
Contributor Author

@JakeDawkins

I'd love to see something like this in the future.

PTAL at https://marketplace.visualstudio.com/items?itemName=GabrielNordeborn.vscode-graphiql-explorer. 😉

@FluorescentHallucinogen
Copy link
Contributor Author

Currently, GraphiQL Explorer doesn't support GraphQL list (array) inputs. This is essential feature.

It would be really nice to have the support with ability to:

  • insert (append) new field to the list after selected field (Ctrl+Ins)
  • duplicate (clone) selected field (Ctrl+D)
  • remove (delete) selected field from the list (Ctrl+Del)
  • reorder (sort) fields in the list by dragging (moving) selected field (Alt+Shift+Arrows)

Here's my vision:

graphiql-explorer-list-array-collapsed

graphiql-explorer-list-array-expanded-insert

graphiql-explorer-list-array-expanded-reorder-sort

@FluorescentHallucinogen
Copy link
Contributor Author

Since we covered all GraphQL built-in scalar types, what about visual forms for commonly used custom scalars like DateTime? 😉

graphiql-explorer-datetime-scalar

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented Dec 21, 2019

File upload is a recent addition to GraphQL. It allows to upload files directly to GraphQL API in addition to sending text data. It uses an Upload scalar. It would be really nice to have a visual form for it too. 😉

graphiql-explorer-upload-scalar

@FluorescentHallucinogen
Copy link
Contributor Author

@Nishchit14 @10S10 PTAL. 😉

@Nishchit14
Copy link

You are a gem @FluorescentHallucinogen 🙌 , These all are the killing features.

The most challenging feature I can say is File uploading directly from the explorer, I would say User would be able to upload multiple files as well.

Also, date-picker is nicer, but It'll add extra CSS/JS cost in bundle (plugin system would work great here), later we can add options of formating (dd-mm-yy, ts, ISO, tz, etc)

We're working on a new design of Firecamp desktop app, and to use explorer I need to plan some customization with it. I'll keep sharing suggestions/feedback on DX improvement :)

@FluorescentHallucinogen
Copy link
Contributor Author

@Nishchit14

I would say User would be able to upload multiple files as well

The user would be able to upload multiple files if so provided by the GraphQL schema, i.e. the mutation argument is an array (list) of Upload scalars — [Upload!]!.

If the mutation argument is an array, it's assumed that the file upload dropzone uses <input type="file" multiple> under the hood. So the user would be able to drag'n'drop multiple files at once, and for each file a new element in the array will be created automatically.

The most challenging feature I can say is File uploading directly from the explorer

Just realized that GraphQL multipart form requests spec requires to use variables to upload file(s).

So I've visualized my vision of the "Variables" panel:

graphiql-variables-array-upload-scalar-form

@FluorescentHallucinogen
Copy link
Contributor Author

Also a variable can be an object:

graphiql-variables-object-form

graphiql-variables-object-json

@Nishchit14
Copy link

This is what we have in @firecampapp (https://firecamp.app)

point no.
2. Single/Multiple File upload
4. Interactive Query Variables
https://dev.to/nishchit14/here-is-the-fastest-graphql-playground-3bci

Although it's an old UI in the blog GIF, but a new design will be up in a week.

@FluorescentHallucinogen
Copy link
Contributor Author

@Nishchit14 Isn't Firecamp open-source? 🤔 Just checked the GitHub repo and haven't found any source codes.

@Nishchit14
Copy link

@FluorescentHallucinogen

It's not open source yet, but we've planned for it in the future. we're working on cloud-sync and team-collaboration. Once we release it then start thinking on the OSS model.

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented Jan 16, 2020

Since Explorer is just another (visual) representation of code, everything that could be possible via code should be possible via Explorer, and vice versa.

So here's the equivalent of "Insert child (nested) fields" feature described in #10 (comment) and #10 (comment):

graphiql-autocomplete-insert-all-and-required-fields

Some thoughts: what about removing the field from the autocomplete list if it's already inserted into the query? 🤔 This may improve UX by helping to avoid duplication of fields.

@FluorescentHallucinogen
Copy link
Contributor Author

Here's my vision of equivalent of "Extract to variable" feature described in #10 (comment):

graphiql-refactor-extract-variable-before

graphiql-refactor-extract-variable-after

Also it would be really nice to have the inverse feature — "Inline variable":

graphiql-refactor-inline-variable

@orta
Copy link

orta commented Feb 14, 2020

Agree - to my knowledge this should be feasible in the graphical plugin system! :D

@acao
Copy link

acao commented Feb 14, 2020

agreeing with @orta, should be possible with graphiql plugins via monaco. might be trickier with vscode but maybe there's things I don't know. @rebornix what do you think?

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented Feb 24, 2020

@nikolasburk @schickling Looks like Explorer-like autocomplete could be applied to GraphQL code-first approaches too. 😉

graphql-code-first-autocomplete

It would be really nice to have something like this in Prisma Studio for visual constructing of data filters.

BTW, thanks a lot to @kuldar from @prisma team for sharing a Figma project with me. All mockups in this thread were made using it.

It seems Explorer-like autocomplete could be applied to any TypeScript code. If so, it would be really nice to have this in VSCode (as a plug-in or built-in).

@orta WDYT?

@FluorescentHallucinogen
Copy link
Contributor Author

The combo of gqless by @samdenty and Explorer-like autocomplete pictured in #10 (comment) would be a DX game-changer! 🤯

@samdenty
Copy link

samdenty commented Mar 22, 2020

Damn these are pretty cool ideas!

For gqless I have been toying around with the idea, of creating an all-in-one devtools.

gqless will be able to do stuff like auto-dispatch mutations, when you update the cache. So stuff like the Table plugin shown above could be live-editable.

This would require direct integration with the gqless Client (but should be usable without one too)

With the clients Cache keying logic, we can display "references" to GraphQL data (instead of Query -> temporary response) in the devtools.

This would turn the devtools from a REPL, to a full-blown GraphQL data explorer (like MongoDB compass, Prisma's data editor etc.)

@acao
Copy link

acao commented Mar 22, 2020

@samdenty sounds great! we are working with vscode on the monaco-editor LSP immplementation as we speak for GraphiQL plugins, that will make building out these experiences very powerful. We will have a GraphiQL Explorer plugin that uses this new monaco service soon! Codemirror Mode will still be available for folks to support, if they want to add the new GraphQL 15 language features

learn more about all of this work in our roadmap

@FluorescentHallucinogen
Copy link
Contributor Author

Here's my vision of search options for #28 (#30):

graphql-advanced-search-options

@FluorescentHallucinogen
Copy link
Contributor Author

I like the idea to combine documentation viewing and query building in Apollo Studio.

graphql-docs-query-build

4 months ago I proposed this idea for Explorer. See the end of this comment: #44 (comment).

Altair by @imolorhe has a similar feature (adding queries and fragments to code right from docs) for years. See https://altair.sirmuel.design/docs/features/add-queries-and-fragments.html.

@acao What about something like this in GraphiQL?

@acao
Copy link

acao commented May 21, 2020

@FluorescentHallucinogen any RFC proposals are still welcome!

if you want to join our plugin API RFC effort so that you can build whatever plugins you want, you are also welcome to join!

we have some different schema/DX approaches we plan on implementing for some plugins, you are free to propose anything you like, and we decide in working groups which plugins to prioritize.

this discussion would have been great for our working group call today, maybe next time?

@FluorescentHallucinogen
Copy link
Contributor Author

After some thought, I realized that combining docs viewing and query building (while remaining interesting idea/experiment) may be not a good idea from a practical perspective. And here's why:

  • They solve different problems. Docs should display some schema things like directives, interface details (like "implemented by" and "required by"), union and type extension (extend type ...) details that don't matter alone out of query building context.

  • Navigation is far from perfect for query building. Docs (current Apollo Studio implementation) displays details of each field (level) on separate page. So to add a specific field, you need to open a bunch of pages, and then press the back button many times to go back.

@jglovier @acao cc.

@FluorescentHallucinogen
Copy link
Contributor Author

BTW, looks like currently there is no integration between GraphiQL Explorer and GraphiQL Docs. It would be really nice if e.g. Ctrl+Click on a specific field in the GraphiQL Explorer would open that field in the GraphiQL Docs.

@acao
Copy link

acao commented May 24, 2020

@FluorescentHallucinogen there is integration between the operation editor and the schema explorer at least, when you click a type name on hover. we will be improving the APIs for this, however an API is already available for this, so this capability you suggest could be introduced with a PR to this repository

@FluorescentHallucinogen
Copy link
Contributor Author

Another crazy idea has came to my mind: a tool similar to GraphQL Editor, but GraphQL Editor is for visual building of GraphQL schemas, and my tool is for visual building of GraphQL queries, similar to GraphiQL Explorer.

graphql-visual-query-builder

@aexol cc.

@FluorescentHallucinogen
Copy link
Contributor Author

Expanding/collapsing arguments:

graphiql-explorer-expand-arguments

@FluorescentHallucinogen
Copy link
Contributor Author

Marking deprecated fields with an icon and strikethrough text:

graphiql-explorer-deprecated-indicator

@FluorescentHallucinogen
Copy link
Contributor Author

As a follow-up of my idea of displaying field description popup on hover in #10 (comment) and #10 (comment), here's a visualization of opening docs for the field by clicking on the icon next to it:

graphiql-explorer-open-docs

BTW, docs for the field can also be opened right from the links in the field hover popup.

This requires the integration between GraphiQL Explorer and GraphiQL Docs.

@mmailaender
Copy link

@FluorescentHallucinogen are you programming that, or is that currently only design? And is there any timeline/priority on this? Because I see the issue started already three years ago :)

@FluorescentHallucinogen
Copy link
Contributor Author

@mmailaender That's currently the only design. I've programmed some of my ideas, but my contribution (see #49 as an example) for some reason is just ignored by project authors without any feedback. :(

@mmailaender
Copy link

@FluorescentHallucinogen seems this project is not really active maintained anymore, based what I see from the commit history. Do you know if GraphiQL has any plans about including your suggestions directly into the main product?

@FluorescentHallucinogen
Copy link
Contributor Author

@mmailaender

Do you know if GraphiQL has any plans about including your suggestions directly into the main product?

I hope so, but I don't know for sure.

See graphql/graphiql#2216. I'm not sure that all my proposals will be implemented, but some of them definitely will be.

GraphiQL has already taken a different path of combining operation building (GraphiQL Explorer) and docs viewing (GraphiQL Docs) into one tool. But my vision is that this is not a good idea, because they solve different problems and this creates visual noise.

@FluorescentHallucinogen
Copy link
Contributor Author

I've visualized how adding directives and constructing their arguments might look like:

graphiql-explorer-add-directives-1

graphiql-explorer-add-directives-2

@Nishchit14 @jonathanawesome @thomasheyenbrock @acao @daniman @aexol @imolorhe @doc-jones PTAL.

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

8 participants
@orta @acao @Nishchit14 @FluorescentHallucinogen @JakeDawkins @samdenty @mmailaender and others