-
Notifications
You must be signed in to change notification settings - Fork 20
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
pt::text
does not produce plain text in useQuery()
#700
Comments
Thanks for reporting this, I'm able to replicate it. @stipsan I guess this is an applySourceDocuments concern? As far as I can tell CSM will provide a mapping for values returned using a |
I am also experiencing this issue - is there a workaround? |
Howdy! Please ensure you’re tagging the correct Cody. I’m not involved with this one. Thanks! |
🤦 Sorry about that! |
Hey, I am having the same issue using preview-kit in a Remix setup: remix-sanity-preview-kit.movHere’s a repository to reproduce the behavior shown in the video above. There’s also an open discussion on the Sanity Slack channel. |
Describe the bug
When using
useQuery()
with a query that includes thept::text
function, theuseQuery
will seemingly ignore the function, and just return the full object. When trying to print the result in JSX, React will crash withObjects are not valid as a React child (found: object with keys {_key, _type, children, markDefs, style})
To Reproduce
Steps to reproduce the behavior:
.env.local
, addNEXT_PUBLIC_SANITY_PROJECT_ID
,NEXT_PUBLIC_SANITY_DATASET
andSANITY_API_READ_TOKEN
npm install && npm run dev
.body
text.Expected behavior
The post should preview correctly, showing the body text as plain text.
Which versions of Sanity are you using?
What operating system are you using?
MacOS Sonoma (14.0)
Which versions of Node.js / npm are you running?
v19.9.0
Additional context
GROQ query which will crash live preview:
The text was updated successfully, but these errors were encountered: