Question about slow updates with Sanity client API
export const sanityClient = client({
projectId: process.env.SANITY_PROJECT_ID,
dataset: process.env.SANITY_PROJECT_DATASET,
apiVersion: '2022-01-12',
useCdn: false,
token: process.env.SANITY_AUTH_TOKEN // Only if you want to update content with the client
});const formattedInterests = interests.length ? interests.map(i => ({
_ref: i._id || i._ref,
_key: i._id || i._ref,
_type: 'reference',
_weak: true
})) : [];
const doc = {
firstName,
lastName,
email,
isSubscribed,
age,
tags: formattedInterests,
city
}
const response = await sanityClient.patch(id).set(doc).commit (); /*
** Sanity configuration
*/
sanity: {
projectId: process.env.SANITY_PROJECT_ID,
dataset: process.env.SANITY_PROJECT_DATASET
},Was this answer helpful?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.