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

feat: [RFC] GraphiQL rewrite for monaco editor, react context and redesign, i18n #1523

Merged
merged 10 commits into from
Jun 11, 2020

Conversation

acao
Copy link
Member

@acao acao commented May 13, 2020

(here, we've re-created #1468 against a non-forked branch, so RFCs are visible in pull requests here) (see: #1446 for details)

image

go ahead and give this rewrite PR a whirl! this is what the new GraphiQL 2.0.0 beta will be based on.

Note: use right click context menu/f1 command palette for the full experience!

Context for State Management

  • makes use of useReducers
  • SchemaProvider, SchemaContext
  • SessionProvider, SessionContext
  • EditorProvider, EditorContext

thank you so much to @cshaver , @zephraph , @ryan-m-walker, @ncthbrt , and @sgrove for contributing to or chiming in on this effort! no small effort by any means.

Monaco Editor

we spiked on and integrated the fantastic monaco-editor with this PR, using our now monaco-graphql mode.

Redesigned Components and Theme UI

thanks to @walaura 's original work, and @cshaver and @harshithpabbati for moving it forward. we are well underway with implementing the redesign!

Temporary Breakages

some features are temporarily disabled by this effort, in the interest of rapid iteration:

  • persisted operations (though your previous query history works in the left sidebar, soon to be deprecated)
  • variables hint/lint aka code completion/diagnostics for variables json. coming soon!

Preview

(use right click/f1 context menu for funsies!)

https://deploy-preview-1523--graphiql-test.netlify.app/bundle/dist/

@acao acao changed the title Feat/use context hooks feat: [RFC] Rewrite for monaco editor, react context and the beginnings of the redesign May 13, 2020
@acao acao force-pushed the feat/use-context-hooks branch from 2b8ff67 to e8e1295 Compare May 13, 2020 15:19
@acao
Copy link
Member Author

acao commented May 16, 2020

rebasing this one after the monaco mode merge! this PR should reduce in size quite substantially

@acao acao force-pushed the feat/use-context-hooks branch from b6b56fd to a8b9a93 Compare May 16, 2020 13:58
@acao acao changed the title feat: [RFC] Rewrite for monaco editor, react context and the beginnings of the redesign feat: [RFC] GraphiQL rewrite for monaco editor, react context and the beginnings of the redesign May 16, 2020
@acao acao force-pushed the feat/use-context-hooks branch from a8b9a93 to 659b700 Compare May 16, 2020 14:04
@acao acao changed the title feat: [RFC] GraphiQL rewrite for monaco editor, react context and the beginnings of the redesign feat: [RFC] GraphiQL rewrite for monaco editor, react context and redesign May 16, 2020
@harshithpabbati
Copy link
Contributor

harshithpabbati commented May 16, 2020

Looks like my i18n PR is failing. I will try to fix it @acao

@acao
Copy link
Member Author

acao commented May 16, 2020

@harshithpabbati no worries! working on it as well, it seems to be this:

File '/home/rikki/projects/graphiql/packages/graphiql/src/locales/en/Errors.json' is not listed within the file list of project '/home/rikki/projects/graphiql/packages/graphiql/tsconfig.json'. Projects must list all files or use an 'include' pattern.

funky that it worked before and not now, haha

@harshithpabbati
Copy link
Contributor

harshithpabbati commented May 16, 2020

Yeah, it's weird

@acao
Copy link
Member Author

acao commented May 16, 2020

@harshithpabbati you can re-create it locally by running yarn build-demo. you might need to yarn && yarn build one time beforehand to reset your codebase

@acao
Copy link
Member Author

acao commented May 16, 2020

@harshithpabbati the funny thing is that this bug is only with storybook, however all of these are builds that pass (thus, they are able to resolve these files):

  • graphiql min/dev webpack
  • monaco vanilla webpack example
  • graphiql example webpack

methinks the answer is a storykbook config

@acao
Copy link
Member Author

acao commented May 16, 2020

@harshithpabbati i think i've found the resolution! turns out you were very close with includes

@acao acao force-pushed the feat/use-context-hooks branch 2 times, most recently from e13b591 to 8de442a Compare May 16, 2020 16:16
@acao acao changed the title feat: [RFC] GraphiQL rewrite for monaco editor, react context and redesign feat: [RFC] GraphiQL rewrite for monaco editor, react context and redesign, i18n May 16, 2020
acao and others added 7 commits May 17, 2020 18:34
- convert all components to functional components
- leverage useEffects dependencies for efficient component subscriptions
- convert editorand query history to use context
- made errors consitent across providers
- allowed for multiple errors
- preserved error objects to allow more custom usage
- SchemaProvider

Co-Authored-By: Justin Bennett <zephraph@gmail.com>
Co-Authored-By: ryan-m-walker <ryan.matthew.walker@gmail.com>
Co-Authored-By: Cristina Shaver <cristina.shaver@gmail.com>
Co-Authored-By: Nick Cuthbert <nick@cuthbert.co.za>
Co-Authored-By: Cristina Shaver <cristina.shaver@gmail.com>
Co-Authored-By: Ryan Walker <ryan.matthew.walker@gmail.com>
Co-Authored-By: Harshith Pabbati <pabbatiharshith@gmail.com>
@acao acao force-pushed the feat/use-context-hooks branch from 1ca3ed5 to 236c261 Compare May 17, 2020 23:03
@acao
Copy link
Member Author

acao commented Jun 11, 2020

1.0.0 has been released, now for the 2.0.0 rewrite to be merged to master!

@acao acao merged commit ad730cd into master Jun 11, 2020
@acao acao deleted the feat/use-context-hooks branch June 11, 2020 18:03
thenamankumar pushed a commit to thenamankumar/graphiql that referenced this pull request Aug 30, 2020
…esign, i18n (graphql#1523)

- rewrite for modern react and context/hooks API
- adopt some of the new components by @walaura
- adopt monaco editor
- adopt i18n-next

Co-authored-by: Justin Bennett <zephraph@gmail.com>
Co-authored-by: ryan-m-walker <ryan.matthew.walker@gmail.com>
Co-authored-by: Cristina Shaver <cristina.shaver@gmail.com>
Co-authored-by: Nick Cuthbert <nick@cuthbert.co.za>
Co-authored-by: Ryan Walker <ryan.matthew.walker@gmail.com>
Co-authored-by: Harshith Pabbati <pabbatiharshith@gmail.com>
Co-authored-by: mohammed osama <mohammedosama@ieee.org>
@acao acao added the graphiql label Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants