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

Nested data on api response are coming as null #105

Closed
1 task done
akash-mahmud opened this issue Oct 1, 2023 · 1 comment
Closed
1 task done

Nested data on api response are coming as null #105

akash-mahmud opened this issue Oct 1, 2023 · 1 comment

Comments

@akash-mahmud
Copy link

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,

  const { data:DoctorsDataForSlider }:{
    data:DoctorsForHomePageQuery | undefined
  } = await getClient().query({ query: DoctorsForHomePageDocument , variables:doctorQueryVariables});

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.
Screenshot 2023-10-01 at 10 44 15 PM

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

Provide environment information

Platform: Macos
Package Manager:  pnpm
Nodejs:v18.16.0
Nextjs:13.4.19

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

@akash-mahmud
Copy link
Author

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.

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

1 participant