fix: enhance node metrics handling by checking state before accessing metrics map

This commit is contained in:
Marvin Zhang
2025-09-12 16:34:40 +08:00
parent 316878e129
commit 07bb7f8ba9

View File

@@ -303,7 +303,7 @@ const useNodeList = () => {
icon: ['fa', 'chart-line'], icon: ['fa', 'chart-line'],
width: '240', width: '240',
value: (row: Node) => { value: (row: Node) => {
if (!row._id) return; if (!row._id || !state.nodeMetricsMap) return;
const currentMetrics = state.nodeMetricsMap[row._id]; const currentMetrics = state.nodeMetricsMap[row._id];
return ( return (
<ClCurrentMetrics <ClCurrentMetrics
@@ -400,7 +400,7 @@ const useNodeList = () => {
const opts = getDefaultUseListOptions<Node>(navActions, tableColumns); const opts = getDefaultUseListOptions<Node>(navActions, tableColumns);
// init // init
setupListComponent(ns, store, []); setupListComponent(ns, store, true);
if (isPro()) { if (isPro()) {
onBeforeMount(() => store.dispatch(`${ns}/getNodeMetrics`)); onBeforeMount(() => store.dispatch(`${ns}/getNodeMetrics`));