Skip to content

Instantly share code, notes, and snippets.

@gpoole
Created September 5, 2023 01:19
Show Gist options
  • Save gpoole/2f7dd438e8464f993d4fb42083a8aa86 to your computer and use it in GitHub Desktop.
Save gpoole/2f7dd438e8464f993d4fb42083a8aa86 to your computer and use it in GitHub Desktop.
Detecting a Sanity asset that's currently being uploaded
// Doesn't seem to be officially documented so I had to borrow this from Sanity:
// https://github.com/sanity-io/sanity/blob/30ab832179f8c8dfc6e1e61938ee784c0709cb25/packages/sanity/src/core/preview/components/_extractUploadState.ts#L4
const isAssetUploading = (asset: any) => asset?._upload?.progress != null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment