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

Can't find "client" when running storybook #12

Open
bruvers opened this issue Jan 16, 2021 · 4 comments
Open

Can't find "client" when running storybook #12

bruvers opened this issue Jan 16, 2021 · 4 comments

Comments

@bruvers
Copy link

bruvers commented Jan 16, 2021

When running yarn storybook Storybook starts up but every story shows an error message:

Could not find "client" in the context or passed in as an option. Wrap the root component in an <ApolloProvider>, or pass an ApolloClient instance in via options.

The same error is displayed when running yarn dev.

How can this be solved?

@bruvers
Copy link
Author

bruvers commented Jan 16, 2021

While looking at this apollographql/apollo-client#2042 (comment) I decided to try something similar and wrapped the root component in pages/_app.tsx with <ApolloProvider /> from @apollo/client.

This seems to fix the problem:

...
import { ApolloProvider as ApolloClientProvider } from '@apollo/client';
import { ApolloProvider } from '@apollo/react-hooks'
...

                return (
			<ApolloClientProvider client={this.client}>
				<ApolloProvider client={this.client}>
...

@Moumouls
Copy link
Owner

Hi @bruvers, thanks for your feedback.

I've just tested a clean install from master and i can't reproduce your issue (in dev and storybook).
Do you have the issue with a fresh master install ?

@bruvers
Copy link
Author

bruvers commented Jan 18, 2021

Hi @Moumouls . Yes, I cloned the repo and tested the master branch. Although I have to say that I used npm to install the modules and since there was not package-lock.json file I could have had some slightly different NPM packages installed than your setup.

My local environment:

$ npm -v
6.10.0
$ node -v
v12.7.0

@Moumouls
Copy link
Owner

Oh yes you found the issue, would like to send a PR to fix this one for an easier start up with NPM ? 🙂

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

2 participants