limit max number of logs page

This commit is contained in:
pompurin404 2024-09-27 17:31:32 +08:00
parent 7ed9af3dd6
commit 21bf35bd06
No known key found for this signature in database

View File

@ -33,6 +33,9 @@ const Logs: React.FC = () => {
window.electron.ipcRenderer.on('mihomoLogs', (_e, log: IMihomoLogInfo) => {
log.time = new Date().toLocaleString()
setLogs((prevLogs) => {
if (prevLogs.length >= 500) {
prevLogs.shift()
}
return [...prevLogs, log]
})
})