apollographql / apollographql/apollo-client-integrations
`registerApolloClient` should only be used in a React Server Component context error when trying to call a Server Action in a Client Component
- Dominant language
- TypeScript
- Stars
- 556
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Greetings!
I have a Server Action in a separate file that uses the ```getClient``` function described in the "In RSC" segment of the readme. As per NextJS documentation it has the 'use server' directive at the top.
I'm trying to call this action in a Client Component using the ```useTransition``` hook, but I get the ```"`registerApolloClient` should only be used in a React Server Component context - in Client Components, use the `ApolloNextAppProvider`!"``` error.
As far as I understand I definitely am in the Server Component context though. If I monkey patch out the check for React.createContext in ```registerApolloClient.ts``` my code seems to function correctly.
Is this a bug or am I doing something I'm not supposed to do?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with registerApolloClient.ts and the README's "In RSC" getClient example, then reproduce the Server Action call from a Client Component using useTransition. Determine whether this usage is supported and whether the context error is triggered incorrectly; done means the supported behavior and any required correction are covered by a regression test or clear documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- full-stack, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100