Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported. #4517
Labels
bug
Something isn't working
Describe the issue that you're seeing. Any Loom videos or screenshots usually help a lot!
When I am transitioning from using
import client from "../../tina/__generated__/client";
toimport client from "../../tina/__generated__/databaseClient";
objects that were previously successfully serializable are no longer serializable.For example, using the client this worked:
With HomeContent looking like this:
This no longer works after changing
client
todatabaseClient
. The reasons for this is unknown, but I suspect under the hood the way TinaCMS handles typing is different somehow. Would be excellent if we could find a way to use Tina's generated types to solve this, without having to manually parse the data everywhere we ask for a result from Tina.The temporary solution
Not a good way to handle this, since I would have to manually change multiple places, and remember to change it. More overhead.
Reproduction
https://github.com/ZynthCode/tina-nextjs-app
Steps to reproduce
git clone https://github.com/ZynthCode/tina-nextjs-app
Navigate to /src/app/page.tsx and change
getHomeProps()
to use the rawData directly fromconst rawData = await client.queries.post({ relativePath: "_home.md" });
, rather than using the hacky a DTO to transfer data.Jump into <HomeContent {...props} /> and replace the props with what we normally would use (using generated types):
Install and run the app:
Navigate to localhost:3000 and you will see error logs:
This does not occur when you use the client and TINA_PUBLIC_IS_LOCAL=true.
System Info
(Same issue in tinacms 1.6.2 btw)
Validations
The text was updated successfully, but these errors were encountered: