const REFRESH_PERIOD = 30 * 60 * 1000 // 30 minutes in microseconds
const focusSupported = typeof document !== 'undefined' &&
                       typeof document.addEventListener !== 'undefined' &&
                       typeof document.visibilityState !== 'undefined'

let hiddenAt = null

function onHide() {
  hiddenAt = new Date()
}

function onShow() {
  const drift = new Date() - hiddenAt
  if (hiddenAt && (drift >= REFRESH_PERIOD)) {
    document.location.reload()
  }
}

function handleChange() {
  if (document.visibilityState === 'hidden') {
    onHide()
  } else if (document.visibilityState === 'visible') {
    onShow()
  }
}

export const startRefreshTimer = () => {
  if (focusSupported) {
    document.addEventListener('visibilitychange', handleChange)
  }
}

@@ -61,16 +61,65 @@
 seconds%0A
+const focusEnabled = ENV.ENABLE_REFRESH_ON_FOCUS%0A
 const fo
@@ -734,16 +734,32 @@
 %7B%0A  if (
+focusEnabled && 
 focusSup

Enable refresh on focus by env var.