fix(site): handle missing default chart time (#2397)

Co-authored-by: henrygd <hank@henrygd.me>
This commit is contained in:
Adrien Boullé
2026-09-23 18:29:31 +02:00
committed by GitHub
parent 8bf6917fe0
commit 9042a8c5c8
7 changed files with 77 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ import { useToast } from "@/components/ui/use-toast"
import { isReadOnlyUser } from "@/lib/api"
import { pb } from "@/lib/api"
import { SystemStatus } from "@/lib/enums"
import { $allSystemsById, $direction, $userSettings } from "@/lib/stores"
import { $allSystemsById, $direction, getUserChartTime } from "@/lib/stores"
import {
cn,
isVisuallyLonger,
@@ -503,7 +503,7 @@ function NetworkMonitorSheetContent({
}) {
// Keep monitor exploration independent of the system charts' time range.
const [chartTimeStore] = useState(() => {
const defaultTime = $userSettings.get().chartTime
const defaultTime = getUserChartTime()
return atom(defaultTime === "1m" ? "1h" : defaultTime)
})
const chartTime = useStore(chartTimeStore)