mirror of
https://github.com/tormachris/cf-workers-status-page.git
synced 2024-11-23 14:45:41 +01:00
fix: prevent histogram render error on initial no data state
This commit is contained in:
parent
a3c928bb9c
commit
5a086f5ad0
@ -39,7 +39,7 @@ export default function MonitorHistogram({ monitorId, kvMonitor }) {
|
||||
<span className="font-semibold text-sm">
|
||||
{dayInHistogramLabel}
|
||||
</span>
|
||||
{kvMonitor.checks.hasOwnProperty(dayInHistogram) &&
|
||||
{kvMonitor && kvMonitor.checks.hasOwnProperty(dayInHistogram) &&
|
||||
Object.keys(kvMonitor.checks[dayInHistogram].res).map((key) => {
|
||||
return (
|
||||
<>
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user