Sanity rich text editor crashes and sync issues during high-traffic periods

7 replies
Last updated: Mar 1, 2023
Good morning!
Our client is using Sanity in production for their digital newspaper. They are having a lot of problems with (probably) the rich text editor.

As a digital newspaper they need to cover important events. In those peak moments is when they experience the most bugs so far. I said
probably because I cannot reproduce the bugs they are getting, so I am assuming that the problems come from the fact that multiple users are writting, collaborating and publishing content at the same time. Some of the things they have told us include:
1. Someone wrote something and the editor crashed. This prevents the user from continue editing the document since an exception is thrown when the document loads
2. Some normal text inputs have delay. When I type, some of the initial characters do not appear in the input
3. Someone was writting and the CORS message appeared (or something else happened that made the page reload) and I lost half of the paragraph I was writting
4. The syncing document toasts keep stacking up and prevent me from publishing documents
To be clear these are not problems that occur always, they happend sporadically and we've not been able to reproduce them. We are in the
^3.4.0
version of Sanity and we've also checked that copy pasting from the places they usually do works as expected.
They are on the Team Plan ($99). I wonder if by purchasing a bigger plan we could fix the issues. Perhaps this is due to bad internet connection or something else, but from our side we don't know how to diagnose the problem better. I would be willing to do a meeting to review the code but I can assure that we are not doing anything special besides a few basic new blocks and annotations.

Thank you :)
AI Update

I understand how frustrating these sporadic issues must be, especially during critical news coverage moments. Let me address your concerns about Studio v3 and collaborative editing.

This Is Not a Plan Limitation

Upgrading from the Team Plan ($99) won't fix these issues. Sanity's real-time collaboration features - including presence indicators, automatic synchronization, and conflict resolution - work the same across all paid plans. There are no rate limits or throttling on paid plans that would cause the symptoms you're describing.

What's Likely Happening

The symptoms you describe - editor crashes, syncing toast stacking, input delays, and sporadic behavior during peak collaborative editing - suggest edge cases in how Studio handles concurrent edits to the same document. When multiple editors work simultaneously on rich text content, the real-time synchronization system (which uses Server-Sent Events protocol) needs to merge changes, and there can be scenarios that cause problems.

Immediate Recommendations

1. Upgrade to Latest Studio v3

You're on ^3.4.0, but there have been numerous bug fixes and stability improvements in later v3 releases. Check the Sanity changelog for specific fixes related to the Portable Text Editor and collaborative editing scenarios with many simultaneous users.

2. Consider Studio v4

Studio v4 is now available and requires Node.js 20+. According to the official announcement, "Your Studio code works exactly as before" - the only breaking change is the Node.js version requirement. The migration is straightforward since no code changes are required to your existing Studio configuration, and you'll benefit from the latest stability improvements.

3. Review Your Custom Blocks and Annotations

Since you mentioned creating custom blocks and annotations, review their schemas carefully. Issues in custom schema definitions can cause rendering problems, especially during collaborative editing. Make sure your custom blocks have proper validation rules and that all required fields are properly defined. Validation errors can sometimes fail silently and cause sync problems.

Addressing Specific Issues

Editor crashes preventing document loading: This typically indicates corrupted data in the document's Portable Text structure. When someone experiences a crash, have them check the browser console for errors - these will tell you exactly what's failing to render. The document may have invalid data that needs to be corrected.

Input delay with missing characters: This is a performance issue that can occur when the editor re-renders as changes come in from other users during heavy collaborative sessions. This is particularly problematic during peak editing times when multiple journalists are working simultaneously.

Content loss after page reload: Sanity Studio does have autosave, but if the sync hasn't completed before a page reload (due to CORS errors or other issues), recent changes can be lost. The stacking sync toasts suggest mutations aren't completing successfully, which would explain the content loss.

Stacking "Syncing document" toasts: This indicates that document mutations are failing or timing out. Possible causes include network issues, validation errors being thrown, or conflicts during concurrent edits that the system can't resolve automatically.

Diagnostic Steps

Since you can't reproduce these issues consistently, you need to capture information when they occur:

  1. Capture browser console errors when crashes or issues happen - save the full error stack traces
  2. Monitor network conditions during peak times - unstable connections can cause sync issues with the real-time updates
  3. Look for patterns - do crashes happen on specific document types or with specific custom blocks?
  4. Check for validation errors - these might be silently failing and causing sync problems
  5. Monitor browser performance - check if the browser is running out of memory during heavy editing sessions
  6. Check network tab - look for failed mutations or timeouts when the sync toasts start stacking

Getting Support

Given that these are production-critical issues for a digital newspaper, I strongly recommend reaching out to Sanity support directly with:

  • Your Studio version (v3.4.0)
  • Browser console errors when crashes occur
  • Examples of documents that cause crashes
  • Network logs showing the stacking sync toasts
  • Information about how many concurrent editors you typically have during peak times

Your Team Plan includes support access, and Sanity's support team can access server-side logs to identify patterns you can't see from the client side. They may have seen similar issues from other high-traffic editorial environments.

Bottom Line

These sound like legitimate bugs rather than expected behavior or plan limitations. Sanity's real-time collaboration is specifically designed for exactly your use case - multiple journalists working simultaneously during breaking news. The combination of upgrading to the latest Studio version and working with Sanity support should help resolve these issues.

These are solvable technical problems, not fundamental limitations of the platform.

Show original thread
7 replies
Hi!Sometimes, when I quickly change between different styling options in the rich text editor, I get the error message where I have to click "Create non-unique keys". Not a big problem, but that might be what they refer to as crashing.
I generally feel that the rich text editor is a bit funky and non-responsive, so I'm considering integrating an editor like editor.js, quill, tiptap or similar.
user H
this also happens but is not what they refer as crashing. When they say crashing they mean the full red page with error message
Okay, yeah I've never encountered that.
When I say crash I mean something like this:
Hi! Thanks for reporting. We’re currently looking into these issues. Hopefully we’ll be able to resolve it soon for everyone past 3.4.0 🙇‍♂️
Thanks for the reply
user Y
!

If I understand your message correctly this is not our fault and is something you have in your radar of things to be fixed. I guess this is caused by the massive adoption and all of the new updates.

Is there a way we can get notified of when these things will get solved so we can notify our client and update the Sanity version?

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?