You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a graphql server.
I am using @apollo/experimental-nextjs-app-support/rsc for registering my apollo client on server and @apollo/client.
Now, I am loading an array of objects from my graphql server.
The data is like this users = [{id:"", name:"", doctor:{bio:"", speciality:""}}]
I am loading this data on a server component. Now the issue is on my client components and my console I am getting this, users = [{id:"", name:"", doctor:null}]
I don't know why this happening. For testing if I convert the data into string using JSON.stringify and then console it I can even see my doctor object inside my user object.
What can be the issue?
This is the code that I am using on my sever component for get the user from apollo client,
As you can see in the screenshot. The first data is showing doctor where I used json.stringify and on the second data doctor is null where I used the parsed data.
Current vs. Expected behavior
Nested object on api response set as null.
I should get my full API response data.
Verify canary release
I verified that the issue exists in the latest Next.js canary release
on my registerApolloClient I was using cache as a result it was not loading my updated server data. I just used fetchOptions: { cache: "no-store" }. which resolved my issue.
Link to the code that reproduces this issue
https://github.com/vercel/next.js/tree/canary/examples/reproduction-template
To Reproduce
I have a graphql server.
I am using @apollo/experimental-nextjs-app-support/rsc for registering my apollo client on server and @apollo/client.
Now, I am loading an array of objects from my graphql server.
The data is like this
users = [{id:"", name:"", doctor:{bio:"", speciality:""}}]
I am loading this data on a server component. Now the issue is on my client components and my console I am getting this,
users = [{id:"", name:"", doctor:null}]
I don't know why this happening. For testing if I convert the data into string using JSON.stringify and then console it I can even see my doctor object inside my user object.
What can be the issue?
This is the code that I am using on my sever component for get the user from apollo client,
As you can see in the screenshot. The first data is showing doctor where I used json.stringify and on the second data doctor is null where I used the parsed data.
Current vs. Expected behavior
Nested object on api response set as null.
I should get my full API response data.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, CLI (create-next-app), Data fetching (gS(S)P, getInitialProps)
Additional context
No response
The text was updated successfully, but these errors were encountered: