fix: chart

This commit is contained in:
hamster1963 2024-12-26 15:17:03 +08:00
parent 93a90f4a33
commit 83122ad867
3 changed files with 12 additions and 3 deletions

View File

@ -103,6 +103,8 @@ function CpuChart({ history, data }: { history: ServerDataWithTimestamp[]; data:
setCpuChartData(historyData) setCpuChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])
@ -224,6 +226,8 @@ function ProcessChart({
setProcessChartData(historyData) setProcessChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])
@ -326,6 +330,8 @@ function MemChart({ data, history }: { data: NezhaAPISafe; history: ServerDataWi
setMemChartData(historyData) setMemChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])
@ -477,6 +483,8 @@ function DiskChart({ data, history }: { data: NezhaAPISafe; history: ServerDataW
setDiskChartData(historyData) setDiskChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])
@ -604,6 +612,8 @@ function NetworkChart({
setNetworkChartData(historyData) setNetworkChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])
@ -750,6 +760,8 @@ function ConnectChart({
setConnectChartData(historyData) setConnectChartData(historyData)
hasInitialized.current = true hasInitialized.current = true
setHistoryLoaded(true) setHistoryLoaded(true)
} else if (history.length === 0) {
setHistoryLoaded(true)
} }
}, []) }, [])

BIN
bun.lockb

Binary file not shown.

View File

@ -68,13 +68,10 @@
"@types/node": "^22.10.2", "@types/node": "^22.10.2",
"@types/react": "^19.0.2", "@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2", "@types/react-dom": "^19.0.2",
"eslint": "^9.17.0",
"eslint-config-next": "^15.1.2", "eslint-config-next": "^15.1.2",
"eslint-plugin-turbo": "^2.3.3", "eslint-plugin-turbo": "^2.3.3",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"postcss": "^8.4.49", "postcss": "^8.4.49",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^4.0.0-beta.8", "tailwindcss": "^4.0.0-beta.8",
"typescript": "^5.7.2", "typescript": "^5.7.2",
"vercel": "^39.2.2" "vercel": "^39.2.2"