MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / formatValue

Function formatValue

web/scripts/ragnar_modern.js:16002–16021  ·  view source on GitHub ↗
(key, v)

Source from the content-addressed store, hash-verified

16000 dashboardStatsCache = { key: null, timestamp: 0, data: null };
16001}
16002
16003async function fetchDashboardStatsForSelection(options = {}) {
16004 const { forceRefresh = false } = options;
16005 const { network } = getSelectedDashboardNetworkKey();
16006 const cacheKey = network ? `network:${network}` : 'network:global';
16007 const now = Date.now();
16008
16009 const cached = dashboardStatsCache;
16010 if (!forceRefresh && cached.key === cacheKey && (now - cached.timestamp) < DASHBOARD_STATS_CACHE_TTL && cached.data) {
16011 return cached.data;
16012 }
16013
16014 if (!forceRefresh && dashboardStatsRequestState && dashboardStatsRequestState.key === cacheKey) {
16015 return dashboardStatsRequestState.promise;
16016 }
16017
16018 const query = network ? `/api/dashboard/stats?network=${encodeURIComponent(network)}` : '/api/dashboard/stats';
16019 const requestPromise = (async () => {
16020 try {
16021 const payload = await fetchAPI(query);
16022 dashboardStatsCache = { key: cacheKey, timestamp: Date.now(), data: payload };
16023 return payload;
16024 } finally {

Callers 1

formatAlertDetailsFunction · 0.85

Calls 1

escapeHtmlFunction · 0.70

Tested by

no test coverage detected