diff --git a/src/components/monitorHistogram.js b/src/components/monitorHistogram.js index 1ee1b5b..83ce47c 100644 --- a/src/components/monitorHistogram.js +++ b/src/components/monitorHistogram.js @@ -39,7 +39,7 @@ export default function MonitorHistogram({ monitorId, kvMonitor }) { {dayInHistogramLabel} - {kvMonitor.checks.hasOwnProperty(dayInHistogram) && + {kvMonitor && kvMonitor.checks.hasOwnProperty(dayInHistogram) && Object.keys(kvMonitor.checks[dayInHistogram].res).map((key) => { return ( <> diff --git a/src/functions/helpers.js b/src/functions/helpers.js index 1df405f..74cd113 100644 --- a/src/functions/helpers.js +++ b/src/functions/helpers.js @@ -1,14 +1,16 @@ import config from '../../config.yaml' import { useEffect, useState } from 'react' +const kvDataKey = 'monitors_data_v1_1' + export async function getKVMonitors() { // trying both to see performance difference - return KV_STATUS_PAGE.get('monitors_data', 'json') - //return JSON.parse(await KV_STATUS_PAGE.get('monitors_data', 'text')) + return KV_STATUS_PAGE.get(kvDataKey, 'json') + //return JSON.parse(await KV_STATUS_PAGE.get(kvDataKey, 'text')) } export async function setKVMonitors(data) { - return setKV('monitors_data', JSON.stringify(data)) + return setKV(kvDataKey, JSON.stringify(data)) } export async function setKV(key, value, metadata, expirationTtl) {