mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
limit max number of logs page
This commit is contained in:
parent
c420f0397c
commit
927b438a4b
|
@ -33,6 +33,9 @@ const Logs: React.FC = () => {
|
||||||
window.electron.ipcRenderer.on('mihomoLogs', (_e, log: IMihomoLogInfo) => {
|
window.electron.ipcRenderer.on('mihomoLogs', (_e, log: IMihomoLogInfo) => {
|
||||||
log.time = new Date().toLocaleString()
|
log.time = new Date().toLocaleString()
|
||||||
setLogs((prevLogs) => {
|
setLogs((prevLogs) => {
|
||||||
|
if (prevLogs.length >= 500) {
|
||||||
|
prevLogs.shift()
|
||||||
|
}
|
||||||
return [...prevLogs, log]
|
return [...prevLogs, log]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user