Issue with deleting objects in Sanity.io UI, objects still appear even after deletion.

31 replies
Last updated: Mar 1, 2022
good mornin....for some reason I cannot delete objects. I deleted them but they still show in the UI. but when clicked the data is all blank for all the objects as tho it was deleted from the db but not from being displayed in the UI for some reason
AI Update

Good morning! This sounds like a caching issue in Sanity Studio. Here are the most common solutions:

Quick fixes to try first:

  1. Hard refresh your browser - Press Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac) to clear the browser cache and reload the Studio
  2. Clear browser cache completely - Sometimes a hard refresh isn't enough, so clear your browser's cache and cookies for the Studio URL
  3. Try incognito/private browsing - Open Studio in an incognito window to rule out browser caching issues

If those don't work:

  1. Restart your development server - If you're running Studio locally, stop and restart sanity dev or your build process

  2. Check your dataset - Verify the documents are actually deleted by querying your dataset directly using Vision (the GROQ query tool in Studio) with a query like:

    *[_id == "your-document-id"]

    If this returns an empty array, the document is truly deleted

  3. Clear Studio's local storage - Open browser DevTools → Application/Storage tab → Local Storage → find your Studio's domain and clear it

Possible causes:

  • Browser caching - Most common cause, especially if you're seeing the document in lists but it's empty when clicked
  • Draft vs published versions - If you deleted only the draft (drafts.document-id) but not the published version (or vice versa), you might still see remnants
  • Studio version issues - Rarely, older Studio versions had caching bugs that were resolved in updates

If the issue persists:

Try checking the Network tab in your browser's DevTools to see if Studio is actually fetching fresh data from the API or serving cached responses. You should see requests to https://[your-project-id].api.sanity.io/... when navigating.

The fact that the data appears blank when clicked strongly suggests the documents are deleted from the database but your browser is showing a cached list view. A hard refresh should resolve this in most cases!

Hi, are you talking about the front end like Next or Gatsby?
no I mean from the Admin sanity.io front end
Hi User. Could you please post a screenshot or a sample of your JSON? As you’re expecting, an object should be unset when it’s removed.
I"m trying to delete via the sanity UI
one second
each of the objects you see in colors has already been deleted thru the UI
JSON looks like
this is happening for the size collection too
That
_type
is for the document itself. Do I understand correctly that you’re seeing that when you first create a document?
These documents were created using an application i wrote in node...i then came to the UI to delete them so i could rerun the application and now they appear to not be deleted
Hi User. Could you please post a screenshot or a sample of your JSON? As you’re expecting, an object should be unset when it’s removed.
this is what's left after the delete...it seems the data was deleted but somehow it still shows up in the sanity UI
I"m trying to delete via the sanity UI
one second
I think what you’re seeing here is the Studio in its state preparing to create a new document. If this were the old (i.e., deleted) document, it would need to have an
_id
as well.
each of the objects you see in colors has already been deleted thru the UI
well i have tried to delete these documents and they do not go away
You’ll see exactly this (just a
_type
) when you create a new document in the studio.
JSON looks like
So the document still exists? Which one are you deleting?
i tried bulk delete to delete all...and i have tried single delete on several of the documents
this is happening for the size collection too
yes they still exist but without the original data
as you can see each document has a title in the UI...but the data does not reflect a title
now i get this...
i cannot even get into my sanity io desktop now
this unhandled error was not happening until just now
That’s a different issue and likely related to this . I will come back to your document issue in a bit.
Thanks for your patience, User. The inability to delete could have been related to that mutations issue. I’d be curious to know what happens if you try now (that issue is resolved).
it works for sure now
Awesome. Sorry about that. Glad you’re back up and running.

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?