Skip to content

Instantly share code, notes, and snippets.

View coreyward's full-sized avatar

Corey Ward coreyward

View GitHub Profile
@coreyward
coreyward / bundleChecker.js
Created March 16, 2021 21:06 — forked from rexxars/bundleChecker.js
Sanity studio bundle update checker
import { useEffect } from "react"
import config from "config:sanity"
const BUNDLE_CHECK_INTERVAL = 60 * 1000
const CHANGES_AVAILABLE_MESSAGE =
"There are changes to the Studio. For the best results the page will be refreshed to update to the latest version of the Studio."
async function getCurrentHash() {
const basePath = (config.project && config.project.basePath) || "/"
const html = await window.fetch(basePath).then((res) => res.text())