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

Voyager tab #103

Closed
mac2000 opened this issue May 4, 2020 · 3 comments
Closed

Voyager tab #103

mac2000 opened this issue May 4, 2020 · 3 comments
Assignees

Comments

@mac2000
Copy link
Contributor

mac2000 commented May 4, 2020

Will be so nice to have an voyager tab side by side with editor and playground, so I can not only prototype my schema but also visualize it

Seems to be doable, in my understanding it will be one more dependency to editor and addition of tab to index.ts with Voyager component being added

But immediately after adding graphql-voyager editors build broke with bazillion of errors complaing that

ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:3634:19
    TS2320: Interface 'IntrinsicClassAttributes<T>' cannot simultaneously extend types 'ClassAttributes<T>' and 'ClassAttributes<T>'.
  Named property 'ref' of types 'ClassAttributes<T>' and 'ClassAttributes<T>' are not identical.

At moment I'm even not sure from where to begin to fix that

@mac2000
Copy link
Contributor Author

mac2000 commented May 23, 2020

Managed to deal with errors above by upgrading react related packages to 16

Then got an issue Cannot find namespace 'SvgPanZoom'. which already mentioned in voyager repo which indeed were fixed by suggested workaround

So all we need to do from now on:

  1. Add voyager as a dependency to both server and editor

  2. In server add

app.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));
app.use('/voyager.worker.js', express.static(path.join(__dirname, '../node_modules/graphql-voyager/dist/voyager.worker.js')));
  1. In editor one more icon and tab like this one:
<div className={classNames('tab-content', {'-active': activeTab === 2,})}>
{this.state.schema && (
  <Voyager introspection={e => this.graphQLFetcher({query: e})} hideSettings={activeTab !== 2} />
)}
</div>

And we got desired tab with voyager

image

@IvanGoncharov
Copy link
Member

@mac2000 Looks great 👍

Managed to deal with errors above by upgrading react related packages to 16

It would be great if you submit this as a separate change.

Then got an issue Cannot find namespace 'SvgPanZoom'. which already mentioned in voyager repo which indeed were fixed by suggested workaround

If you know how to fix it in Voyager repo I would gladly accept PR there.

@IvanGoncharov
Copy link
Member

@mac2000 I reviewed #112 and it looks great 👍
I made a few small changes on master that you need to accommodate other than that this feature looks ready to be merged.
Can you please reopen #112 or create a new PR?

mac2000 added a commit to mac2000/graphql-faker that referenced this issue May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants