mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 10:46:16 +01:00
fix loading system with direct id url
This commit is contained in:
@@ -189,13 +189,19 @@ export default memo(function SystemDetail({ id }: { id: string }) {
|
|||||||
|
|
||||||
// find matching system and update when it changes
|
// find matching system and update when it changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!systems.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// allow old system-name slug to work
|
||||||
const store = $allSystemsById.get()[id] ? $allSystemsById : $allSystemsByName
|
const store = $allSystemsById.get()[id] ? $allSystemsById : $allSystemsByName
|
||||||
return subscribeKeys(store, [id], (newSystems) => {
|
return subscribeKeys(store, [id], (newSystems) => {
|
||||||
const sys = newSystems[id]
|
const sys = newSystems[id]
|
||||||
|
if (sys) {
|
||||||
|
setSystem(sys)
|
||||||
document.title = `${sys?.name} / Beszel`
|
document.title = `${sys?.name} / Beszel`
|
||||||
sys?.id && setSystem(sys)
|
}
|
||||||
})
|
})
|
||||||
}, [id])
|
}, [id, systems.length])
|
||||||
|
|
||||||
// hide 1m chart time if system agent version is less than 0.13.0
|
// hide 1m chart time if system agent version is less than 0.13.0
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user