-
Notifications
You must be signed in to change notification settings - Fork 36
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
Newbie question: can this be used for browser-side Apollo queries/mutations too? #275
Comments
Ah it looks like I tried to use |
At this point, you should be able to use all hooks just directly from |
After fixing the URL, it started working as expected. I also discovered I can get the client in queries/mutations result. Not sure if possible, but a check to make sure the URL is not empty would be useful. The error messages I got did not point me there. One thing that's not completely clear to me if whether credentials (auth cookies for instance) would work during SSR, but I'm guessing they should? |
You would manually need to "forward" auth cookies during SSR. |
@phryneas Thank you for the answer and pointer. PS: The README file of |
PRs to fix things like that up are very welcome! I just put up the library to help people, but it's not very polished. |
hi, how could you fix the URL, I have the same issue, if I use environment variables in ApolloWrapper when configuring HttpLink like this:
same problem with my token, but if I hard code the variables everything works fine. |
Assuming you are using NextJS, a |
@therealgilles thanks so much for the clarification. |
Closing as answered. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
I'm trying to use this package on a new project. I am wondering if it can be used for browser-side Apollo queries/mutations too. The RFC mentioned providing a
useApolloClient()
hook but I don't see one available from this package.In my scenario, I need:
(1) is working as expected, but (2) is not. Despite the
ApolloWrapper
, Apollo is complaining there is noApolloProvider
. If I try to useuseQuery()
, I see it's making graphql request to localhost instead of the URL I configured. Meaning it looks like it's using an non-configured client.What am I missing? Help and advice welcome.
The text was updated successfully, but these errors were encountered: