All Questions

Tagged with
Filter by
Sorted by
Tagged with
77 votes
1 answer
50k views

Next.js: Reduce data fetching and share data between pages

I'm looking for solutions for better data fetching in a Next.js app. In this question I'm not just looking for a solution, I'm looking for multiple options so we can look at the pros and cons. The ...
eivindml's user avatar
  • 2,350
9 votes
2 answers
6k views

Getting the "URLSearchParams.set is not implemented" error when trying to fetch data from my sanity backend using React Native

I am getting an error in my to react native project when pulling data from my sanity backend    this is the error URLSearchParams.set is not implemented This is where I am fetching he data  import {...
christian fasole's user avatar
5 votes
4 answers
8k views

How to retrieve a referenced field data inside inputComponent in Sanity.io?

In Sanity Studio, I was trying to get all Document's properties inside an input Component. Follow this article An officially supported way to get at the document content I was able to use withDocument ...
Hieu Pham's user avatar
  • 359
5 votes
2 answers
5k views

next.js13 fetching data with an async function and also use state?

i hope you are having a great day ! i got a question... i'm currently learning next.js 13 and so i thought doing a personal project with it would be a good idea . Currently i'm doing an e-commmerce ...
Martin Sosa's user avatar
4 votes
1 answer
7k views

Why NextJS give me this hydrating error after refreshing the page?

When I refresh my page I got these erorrs : Text content does not match server-rendered HTML. Hydration failed because the initial UI does not match what was rendered on the server. There was an ...
Pickez's user avatar
  • 75
4 votes
4 answers
4k views

Uncaught Error: Configuration must contain `projectId`( when using environment variable )

Only when using an environment variable for projectId inside sanityClient, it can't find it even though is inside the .env file My goal is to connect backend data from Sanity to my frontend in ...
kebron solomon zerie's user avatar
4 votes
1 answer
2k views

Sanity draft preview not working with block content

I've made two iterations of a blog creation experience. The first consisted of an array of different object and document types such as paragraph, gallery, quote, etc while the second, and most recent ...
Mr.Smithyyy's user avatar
  • 1,779
3 votes
3 answers
2k views

Cannot using React Syntax Highlighter in Next.js 13 & Sanity v3

Hello i have a problem for my project using Sanity v3 and React Syntax Highlighter. When i use Refactor library for showing my code in the browser it works by looking a tutorial in Code Input by ...
M Muqiit Faturrahman's user avatar
3 votes
2 answers
1k views

sanity start won't log me in

Did sanity upgrade -> npm install -> sanity init -> sanity start. I was given localhost:3333 link. Was able to try either Google or Github when logging in but it just goes back to login ...
kev's user avatar
  • 555
3 votes
3 answers
932 views

Data is not updated after changes in the Sanity Studio

I am quite new to Sanity v3 + Next.js v13. Everything works great on my test site, but I have a problem when I update a document (project) or add a new one in the Sanity Studio – these changes are not ...
podeig's user avatar
  • 2,671
3 votes
1 answer
590 views

How to custom preview mode in Sanity Studio with Nextjs

I have problem to show the preview mode because the url must contain few parameter that is "category" and "slug". (example in my picture bellow). This is the error url with ...
Toss's user avatar
  • 63
3 votes
2 answers
162 views

Error while mapping the sanity schema in my react webiste

I am trying to map a sanity schema, but I am unable to do so, please help me if any knows: This is the sanity schema categories.js which I want to traverse, here I want to traverse the features array ...
Yashwant's user avatar
3 votes
1 answer
284 views

Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error

I received a github repo backup from somebody elses account. The project is running gatsby, sanity cms and is hosted via netlify. When I extract the archive and saving the folder locally, I am ...
user5123123's user avatar
3 votes
1 answer
299 views

Escape HTML entities and render URL dynamically

The problem can be seen here I built a site using Sanity headless CMS and GatsbyJS on the frontend. I'm querying URLs dynamically so that it can be rendered inside the src attribute of an </iframe&...
Null isTrue's user avatar
  • 1,892
3 votes
1 answer
2k views

GraphQL - Gatsby.js- React component. - How to query with variables/arguments?

I have a React Component that needs to query data. And I want to pass arguments/variables to the query. But I don't know how to do that. For example. I have this blog item carousel that wants to query ...
Tim's user avatar
  • 881
3 votes
2 answers
1k views

Upstream dependency conflict, npm sanity/client

I'm trying to make a nextjs/sanity project at the moment, and I think I may have installed sanity client twice, but not entirely sure. This is the error I'm getting in the command terminal: npm ERR! ...
paparonnie's user avatar
3 votes
1 answer
215 views

Error while connecting sanity content lake to frontend

I'm getting an error while fetching blogs from sanity to my template, I'm creating a next.js website Error: Error: Unknown block type "undefined", please specify a serializer for it in the ...
Sushant Bansode's user avatar
2 votes
4 answers
3k views

Parsing Error: Cannot find module '@babel/preset-env' for Sanity

For a React project, I installed Sanity under the schema folder and then I started adding different JS files into it, but even though there is no code in them, I get the error in the header for each ...
Batuhan Taştekin's user avatar
2 votes
2 answers
2k views

Content is not updating until re-deploy nextjs 13 and sanity

Hello i am using nextjs 13 server components using /app directory and sanity studio. my code looks like this const Page = async () => { const query = groq`*[_type == "university"]`; ...
JoyShaheb's user avatar
  • 357
2 votes
1 answer
978 views

Reasoning with _raw and normal data in Gatsby, GraphQL and Sanity

I've just started using Gatsby with the Sanity headless CMS. For the most part it's pretty straight forward; but knowing best practises for querying the data through GraphQL is still bothering me. ...
shennan's user avatar
  • 11.2k
2 votes
2 answers
4k views

SVG is being passed to img src as an object

For a website using NextJS and Sanity.io, I am importing an image locally import large_logo from '../../assets/logo-large-1200x630.svg and am calling it inside an img tag as src <img src={...
ebsco's user avatar
  • 31
2 votes
4 answers
1k views

Sanity Error: `dataset` must be provided to perform queries with React

I'm trying to create a blog with Sanity CMS; when I try to get data from Sanity database i get that "Error: dataset must be provided to perform queries" I got client.js component with ...
Sebastian Lewy's user avatar
2 votes
1 answer
1k views

Sanity Query Does Not Return Updated Data Consistently

I have a "film" category in my Sanity database which has an array of comments. In my UI, I present a pic of the film with the comments listed below the film. I created a function to add ...
Scott F.'s user avatar
2 votes
1 answer
2k views

Sanity.io, is any way to to change field type painlessly?

I have quite a lot documents in the sanity.io with completed fields. There is a need to change field type. And here are the problem: Now I need to rewrite this field from old to the new and delete ...
kizoso's user avatar
  • 1,216
2 votes
3 answers
4k views

Module not found: Can't resolve '@sanity/client'

I keep getting this error on localhost Failed to compile ./lib/client.js:1:0 Module not found: Can't resolve '@sanity/client' > 1 | import sanityClient from '@sanity/client'; 2 | import ...
DiwSlow's user avatar
  • 21
2 votes
1 answer
878 views

Convert String type to slug type for sanity io

I am importing data from an external API into my sanity schema and the API contains the slug in the form of a string. I have tried removing the double quotes of the string and making it single quoted ...
Marium Ali's user avatar
2 votes
1 answer
84 views

Next Js Api routes response helpers (redirect)

I'M trying to create a login functionality in Next js. Everything is pretty much done but I'm unable to redirect to homepage after login. I'm using Next js with sanity as headless CMS This is my login ...
NexCodes's user avatar
  • 131
2 votes
2 answers
10k views

Refreshing Server side props - Nextjs

I have a list of posts, fetched with getServerSideProps in the home page, then these posts are passed as props to a Posts component, which maps those posts and pass each one to a Post component. ...
ivanatias's user avatar
  • 3,683
2 votes
1 answer
82 views

Dynamic pages at load time, not build time

I'm building an editorial site that regularly adds new content. As such, they've requested that articles and article content is loaded in at load time rather than having to run a build and wait for it....
Chrish D's user avatar
2 votes
1 answer
6k views

How to Async/Await using useEffect for fetching data? [duplicate]

I have looked up some questions but didn't manage to fix this issue. I am trying to add async and await to my useEffect where I am fetching for data. Also, how can I add a simple loading text before ...
Galanthus's user avatar
  • 2,100
2 votes
1 answer
459 views

Storing Sanity token as a secret with Now doesn't work

I am trying to store a Sanity token as a secret when deploying my project with Now, but it all doesn't seem to work. Here is my situation: I added my Sanity token as a secret to the CLI (I called it ...
MarekMinor's user avatar
2 votes
0 answers
667 views

Next.js 13 'TypeError: fetch failed' while trying to render static pages using getStaticProps. Need help fixing code

I'm new to APIs. I'm using Sanity for my backend. This is the error I get in the terminal: - info Linting and checking validity of types - info Creating an optimized production build - info Compiled ...
Ishaan2053's user avatar
2 votes
0 answers
295 views

Sanity - How to populate a list of predefined strings based on another field in the same document?

I want to make a section field which it's options will be based on the category value I tried this but it didn't work defineField({ name: 'category', type: 'string', title: 'Category'...
Abdirisak's user avatar
2 votes
0 answers
439 views

How to implement nested list using @portabletext/react npm in nextjs with sanity.io

i get stuck when wanna implement nested list using @portabletext/react package in nextjs, i need to show my list (in this case using bullet list) in different condition. In the normal condition to be ...
Toss's user avatar
  • 63
2 votes
0 answers
307 views

Uncaught TypeError: Method Promise.prototype.then called on incompatible receiver #<Promise> at Proxy.then (<anonymous>)

Been trying to fix this for a while and it's becoming quite annoying, help would be really appreciated. Context using sanity.io cms and I think the error may come from client.js, where the client is ...
Joe Matkin's user avatar
2 votes
0 answers
376 views

Object object being displayed when trying to render blockContent on React

I am working on a website and trying to render a blockContent from Sanity.io, in my React application, but it's displayed as only [object Object] on the website. I tried different queries on Sanity ...
Sanjay G.'s user avatar
2 votes
0 answers
455 views

Cannot read properties of undefined (reading 'length') Lottie React

I get an undefined issue while trying to set lotties using lottie-react I am setting CDN link instead of just importing it directly . This is the code : {missions.map((mission : any) => ( <...
Yaakoubi Mohammed's user avatar
2 votes
1 answer
353 views

Uncaught TypeError: (0 , _sanity_client__WEBPACK_IMPORTED_MODULE_0__.sanityClient) is not a function

I'm trying to fetch data from Sanity into my react app for the first time. At the moment, I'm trying something small, so I have a schema called website_images, that has an image type called about and ...
paparonnie's user avatar
2 votes
1 answer
748 views

Unknown type: code || getting this error in sanity as schema error

I Have installed sanity code-input plug-in using yarn. Now I'm having this error Error Here I'm using type code { name: 'exampleUsage', title: 'Example usage', type: 'code', }...
NexCodes's user avatar
  • 131
2 votes
2 answers
2k views

how to disable button until a request is completed

I have a like button and once a user clicks on it, the button should only allow one click (i.e allow only one like per user) <button disabled={buttonState} onClick={() => {like(item)}}> &...
Sai Krishnadas's user avatar
2 votes
0 answers
2k views

Error: Unable to resolve image URL from source (undefined) SANITY.IO

Error: Unable to resolve image URL from source (undefined) I did my ImageBuilder configuration in another file and imported the urlFor function into my component. While I am able to map through/...
Badt0men's user avatar
  • 263
2 votes
1 answer
290 views

How to read/pass vercel system enviroment variables to code in Sanity?

I want to pass the VERCEL_GIT_COMMIT_REF variable to my javascript bundle. I've deployed Sanity in Vercel and it only passes variables with the prefix SANITY_STUDIO_. So, I've created an environment ...
Hariharan K's user avatar
2 votes
4 answers
1k views

I am building a React Application using the Sanity CMS for the backend but I am running into a client error when sending data to the backend

I am building a react application and using a Sanity CMS for the backend but I am running into an issue whenever I try to load data into the backend from the client. Everything else works perfectly ...
coding beast's user avatar
1 vote
3 answers
2k views

Error: Errors while building: ./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js Module parse failed: Unexpected token (307:11)

Hi everyone hope you all doing good, I am trying to add a plugin to sanity and the plugin is sanity-plugin-order-documents .I have followed all the steps shown in the documentation step by step. I ...
Abdellah Slimani's user avatar
1 vote
3 answers
6k views

Error: Unable to resolve image URL from source (null)

I am using Sanity and React to create a blog page. Everything seems to be okay but when you click on a blog to read more I get the error message "Error: Unable to resolve image URL from source (...
Susan's user avatar
  • 45
1 vote
5 answers
938 views

Sanity CMS data is not showing on the react app

I was following a tutorial on youtube (https://youtu.be/3HNyXCPDQ7Q) for creating a portfolio website. I hosted the website using Netlify, 20 days later when I revisited the website, the website was ...
pppratspota's user avatar
1 vote
1 answer
4k views

how to display images from (block content) rich text in portable text

how to display images from (block content) rich text in portable text using sanity as backend and next js as front end. my portable text look like this <PortableText value={blog.body} /> no ...
Mohid Naeem's user avatar
1 vote
2 answers
453 views

Vercel Build Error: It looks like you're using options meant for '@sanity/preview-kit/client'

Hi Im having an odd issue with Vercel deployment because of sanity, this is the Vercel build error: Error: It looks like you're using options meant for '@sanity/preview-kit/client', such as '...
André Gomes's user avatar
1 vote
1 answer
2k views

How to delete a document attribute in Sanity iO?

I have an array of objects in my Sanity Document called Images called Comments an example comment object in comments[] array looks like : { "_key": "6510dc79cf8b", &...
dev's user avatar
  • 285
1 vote
3 answers
1k views

Access to an Array inside a Post Array with Sanity using next.js

I have an issue here trying to access a Post array that has inside a categories array. So if I console.log the data I see something like this: { posts: [ { _createdAt: '2021-10-23T05:02:...
theKid's user avatar
  • 592

1
2 3 4 5 6