Issue with commenting on distinct words/sentences in Sanity studio, error when upgrading to latest version

4 replies
Last updated: Apr 17, 2024
Hi! I have a quick question regarding Comments. I know it’s still in beta, but according to this , “Comments can be attached to any compatible field, or even to distinct sentences or words within Portable Text!”
But in my studio, I am only able to comment on whole sections, and not distinct words/sentences inside. Does anyone know what could be the issue? Am on sanity version 3.21.1, thanks!
AI Update

Based on the documentation, inline commenting on distinct words and sentences within Portable Text is indeed a supported feature in Sanity's Comments system. If you're only able to comment on whole sections and not individual text selections, there are a few likely reasons:

1. Studio Version Issue

You're on version 3.21.1, but inline Portable Text commenting may require a more recent version. The Comments feature has been receiving regular updates throughout its beta period. Try updating to the latest Sanity Studio v3 version:

npm install sanity@latest

2. Plan Requirements

Comments is available on the Growth plan and higher, with a 30-day free trial for new projects. Make sure your project has access to the Comments feature. If you're on a free/Starter plan, you might have limited functionality even during the trial.

3. Portable Text Field Configuration

The inline commenting feature needs to be properly enabled for your Portable Text fields. While the feature should work by default on compatible fields, ensure your Portable Text editor is configured as a standard block type without custom configurations that might interfere with the commenting overlay.

4. Browser/Cache Issues

Sometimes Studio features don't load properly due to cached assets. Try:

  • Hard refreshing your browser (Ctrl+Shift+R or Cmd+Shift+R)
  • Clearing your browser cache
  • Testing in an incognito/private window

5. Field Compatibility

Not all field types support inline commenting. The feature specifically works with:

  • Standard Portable Text fields (block content)
  • Compatible field types at the field level

If you have heavily customized Portable Text configurations or are using custom components, this might affect inline commenting capabilities.

Troubleshooting Steps:

  1. Update to the latest Studio version
  2. Verify your project is on Growth plan or has an active trial
  3. Test on a fresh, standard Portable Text field without customizations
  4. Check the browser console for any errors when attempting to comment
  5. Try accessing the Studio from a different browser

Since Comments is still in beta, if none of these resolve your issue, you might be hitting a genuine bug. Consider reaching out to Sanity support or posting in the Sanity Slack community with specific details about your schema configuration and any console errors you're seeing.

Can you try updating to the latest version?
thanks for the help, if I upgrade to latest version i.e. 3.38.0, I get an error when I try to run the studio locally, any idea what could be the issue?

1] TypeError: Cannot read properties of undefined (reading 'div')
[1]     at Object.<anonymous> (/Users/gurdenbatra/Desktop/circulaw/studio/node_modules/sanity/node_modules/@sanity/ui/dist/index.js:1237:40)
[1]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[1]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[1]     at Module._load (node:internal/modules/cjs/loader:1023:12)
[1]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[1]     at require (node:internal/modules/helpers:176:18)
[1]     at Object.<anonymous> (/Users/gurdenbatra/Desktop/circulaw/studio/node_modules/sanity/lib/_chunks-cjs/_internalBrowser.js:2:899)
[1]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[1] Unhandled rejection: TypeError: Cannot read properties of undefined (reading 'div')
[1]     at Object.<anonymous> (/Users/gurdenbatra/Desktop/circulaw/studio/node_modules/sanity/node_modules/@sanity/ui/dist/index.js:1237:40)
[1]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[1]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[1]     at Module._load (node:internal/modules/cjs/loader:1023:12)
[1]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[1]     at require (node:internal/modules/helpers:176:18)
[1]     at Object.<anonymous> (/Users/gurdenbatra/Desktop/circulaw/studio/node_modules/sanity/lib/_chunks-cjs/_internalBrowser.js:2:899)
[1]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
error Command failed with exit code 1.
info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
hey thanks that fixed the issue!
Great!

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.

Was this answer helpful?