sanity-studio-listeners

Installation
SKILL.md

Studio listeners

Studio keeps data live with listeners: long-lived requests that stream changes from the Sanity API. A browser runs at most 100 requests at a time on its connection to the API, and every Studio tab shares that connection (on HTTP/1.1, browsers open only 6 connections per host). A listener holds its slot for as long as it is open, and a Studio tab normally has 6 to 12 open.

Code that opens a listener for every item it renders multiplies by items, then by tabs. Once the slots run out, every request in every tab waits: the newest tab hangs on its spinner, documents and previews stop loading, and a tab that does load can show missing validation errors. The goal is that your code adds a constant number of listeners, never one per item.

Studio already keeps one listener open that follows every document in the dataset. Read documents, validation and permissions through it, and open a listener of your own only when it can't serve the query.

Workflow

Installs
37
GitHub Stars
203
First Seen
7 days ago